command line troubles

Started by justopan, March 14, 2006, 00:41:13

Previous topic - Next topic

justopan

hey, i'm having trouble running getting things running via the command line. this works (adapted from the installing page)
java -cp .;.\shadertest.jar;lib\lwjgl.jar;lib\lwjgl_test.jar;lib\lwjgl_util.jar;lib\lwjgl_fmod3.jar;lib\lwjgl_devil.jar;lib\jinput.jar; -Djava.library.path=lib test.shadertest

however this does not work:
java -jar shadertest.jar -cp .;lib\lwjgl.jar;lib\lwjgl_test.jar;lib\lwjgl_util.jar;lib\lwjgl_fmod3.jar;lib\lwjgl_devil.jar;lib\jinput.jar; -Djava.library.path=lib

but its *not* that it cant find a main class (theres a manifest file in the jar file, putting test.shadertest at the end makes no difference), it says it can't find LWJGLException!
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException

even though that is plainly in lwjgl.jar. so i'm thinking i'm doing something wrong mixing jars on the classpath and with the -jar option? i really dont know. why it matters, though, is that is what launch4j essentially does to wrap a jar in an exe, and when that failed i checked to see if it worked manually on the command line (without the exe wrapper), and it didnt...so, not sure.

anyway, i get the same problem from launch4j's generated exe, so i figure i've messed up the jre's arguments. thanks for your help!

justopan

hmm, ok, apparently this is well know behavior...the -jar flag disables classpath declarations. you usually add it to the manifest file then, i added this, but it still doesnt work...

Class-Path: /lib/lwjgl.jar /lib/lwjgl_util.jar

LWJGLException still not found. any ideas?

justopan

ok, final entry. just talking to myself  :)  the problem was maybe that i was editing an eclipse manifest file manually after the jar was created via winrar. by using a saved manifest in my eclipse workspace, somehow, even though this wasnt the order i typed it in, eclipse put the classpath line in the post above *before* the main class declaration. i guess that makes the difference. heres the final manifest file:

Manifest-Version: 1.0
Class-Path: lib\lwjgl.jar lib\lwjgl_util.jar
Sealed: true
Main-Class: test.shadertest

Fool Running

hmm, ok, apparently this is well know behavior...the -jar flag disables classpath declarations. you usually add it to the manifest file then...

So that's why it didn't work! I tried creating a .jar with my code and it couldn't find LWJGL and I couldn't figure out why. :lol:
I guess, for future reference, I know what to do. :)
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D