I have a class, test, as follows
import java.io.File;
import java.io.IOException;
import org.ini4j.InvalidFileFormatException;
import org.ini4j.Wini;
public class test {
public static void main(String[] args) throws InvalidFileFormatException, IOException{
File f = new File("ini.ini");
Wini ini = new Wini(f);
int a = ini.get("test", "a", int.class);
int b = ini.get("test", "b", int.class);
int c = ini.get("test", "c", int.class);
System.out.print(a);
System.out.print(b);
System.out.print(c);
}
}
To compile I run the command
javac -classpath ini4j-0.5.4.jar test.java
which compiles without issue, but when I try to run it with the command
java -classpath ini4j-0.5.4.jar test
I get the error Error: Could not find or load main class test
.
If I exclude the -classpath ini4j-0.5.4.jar
from the java .. test
command I get an error Exception in thread "main" java.lang.NoClassDefFoundError: org/ini4j/InvalidFileFormatException ...
The class runs fine in eclipse.