I’ve read around a lot but haven’t been able to find a solution yet.
I’m using lwjgl, it needs 2 jars and a native library to run: lwjgl.jar, lwjgl_util.jar and the natives library. I’ve tried this in every way i could think of, anyway, I’m trying with a command like this at the moment:
java - Djava.library.path="libs/natives/" -cp libs/jars/lwjgl.jar:libs/jars/lwjgl_util.jar DisplayTest.class
but in every way i try, i get:
Exception in thread "main" java.lang.NoClassDefFoundError: DisplayTest/class
Caused by: java.lang.ClassNotFoundException: DisplayTest.class
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:321)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: DisplayTest.class. Program will exit
Oh and it might be worth to mention that I’m working on a linux terminal.
Also, i get this to run perfectly fine in eclipse so I can’t really understand whats up here.
First off, you just need to pass the class name to java:
(linebreaks for readability)
I would try the following:
1) Use the CLASSPATH enviroment variable, as in:
Notice the dot (.) at the very beginning of the classpath;
2) Run your java application:
If this works, add the commands above to a shell script. Good luck!