I'm executing the java binary from one of my classes, and a ClassNotFoundException gets thrown:
Results of executing:/usr/bin/java -classpath "/home/geo" Geoline
Error stream:
Exception in thread "main" java.lang.NoClassDefFoundError: Geoline
Caused by: java.lang.ClassNotFoundException: Geoline
at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:336)
Could not find the main class: Geoline. Program will exit.
Output stream:
The Geoline class is located at /home/geo/Geoline.java. The thing is, no matter where in the filesystem I'm located, if I execute the same command manually, the class is executed. Why isn't the same thing happening when the binary is executed with Runtime.getRuntime().exec?
edit: here's the output generated with the verbose flag on: pastie link edit: here's the contents of the file :
public class Geoline {
public static void main(String[] args) {
System.out.println("blabla");
}
}