So i am using Netbeans as my coding environment, i downloaded and installed LWJGL into netbeans exactly the way it states to do so. I did a few lessons, copied some demo programs, and everything so far is working and running properly. It is all fine and dandy, until i go to export the application i am testing. It exports and says it is clean with no errors, but when i attempt to run the ‘.jar’ file, it does nothing, and eventually gives me an error message that the application does not run.
I go and check the console for error messages and it gives me this:
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754}Exception in thread "main"
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]java.lang.NoClassDefFoundError: org/lwjgl/LWJGLException
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]Caused by: java.lang.ClassNotFoundException: org.lwjgl.LWJGLException
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]at java.security.AccessController.doPrivileged(Native Method)
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
2/22/12 4:59:15 PM [0x0-0x2b82b8].com.apple.JarLauncher[63754]at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
I am guessing that the LWJGL files did not get included into the final jar file. How can i correct this so i can export applications using LWJGL?
You will need to set the class paths in order to run the jar from terminal. You may wish to use a shell script (mac linux) or batch file(windows) to run it.
The command will look something like this, you can stick it in to the shell script and run the shell.(This is the one I use for my lwjgl projects.)
You will need to change -Djava.library.path=native\macosx depending on your os. windows/linux/macosx.
I use these libraries http://sourceforge.net/projects/java-game-lib/ I would imagine that you or any one else with the same issue is using the same.