LWJGL Forum

Programming => LWJGL Documentation => Topic started by: verthex on January 05, 2011, 10:19:00

Title: JCreator LE issues
Post by: verthex on January 05, 2011, 10:19:00
Hello,

So this is the error I'm getting:

--------------------Configuration: game - JDK version 1.6.0_16 new tool - <Default>--------------------
java.lang.NoClassDefFoundError: command
Caused by: java.lang.ClassNotFoundException: command
   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: command.  Program will exit.
Exception in thread "main"
Process completed.


I tried setting up the IDE according to http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_JCreator (http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_JCreator)
and also edited the parameters in the tools for running the program as:

-classpath "$[ClassPath]" -Djava.library.path= "C:\lwjgl-2.6\native\windows" $[JavaClass]

which I found on this page http://lwjgl.org/forum/index.php?topic=1300.0 (http://lwjgl.org/forum/index.php?topic=1300.0)

and I tried to compile the code on this page http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_NetBeans (http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_NetBeans)
which did compile but then I got the error when trying to run it?
Title: Re: JCreator LE issues
Post by: jediTofu on January 05, 2011, 11:15:01
Do not put a space between = and " here:
-Djava.library.path="C:\lwjgl-2.6\native\windows"

Not sure if that will fix it.  Also, if you go to that directory, are the DLL's there?

Might need to search around the JCreator website for how to add a Java VM Option.  I copied & pasted that tutorial from the very outdated one on the main page, and as I don't use JCreator, I have no idea how you are supposed to specify VM options.  I can't search right now, but I'll try searching later today.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 11:42:08
Fixed the space and also checked the DLL's but no luck.


EDIT:: Tried searching about JVM in the help files of Jcreator as well as Google but no luck either. jcreator talks about the classpath stuff and I already edited that.
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 11:47:17
hmm, error seems to suggest that java can't find your main class called 'command' so doesn't look like an LWJGL issue. Check that your main class is properly setup/created in the IDE.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 12:02:34
Thats the one thing not one tutorial seems to show and I set that up myself. I'm not sure how I should setup the example code I posted the link to above. Could you go through that with me?


I tried setting up the project as an empty project using a file called a Main class and got this error:

--------------------Configuration: Main - JDK version 1.6.0_16 <Default> - <Default>--------------------
Keys:
down  - Shrink
up    - Grow
left  - Rotate left
right - Rotate right
esc   - Exit
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.lwjgl.opengl.Display
   at game.destroy(game.java:90)
   at game.main(game.java:55)

Process completed.
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 12:17:55
ok now that error simply means that lwjgl.jar is not setup correctly as an external jar, double check that.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 12:23:21
I checked my "required libraries" under project settings and its in the list. Is that what you mean by external?


EDIT:: I got that last error because I didn't have my parameters checked in the JDK tools section.

I recompiled and ran and got the error I first posted.
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 12:26:46
well to setup LWJGL there are two steps.

1) the java part, lwjgl.jar must be on the classpath, its a 3rd party library so usually added as an external jar.
2) the native part, this is done using "-Djava.library.path" to point to the folder containing the native files.

The error you get seems to suggest that step one is not setup correctly.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 12:29:43
This is my complete classpath and its in there?
C:\Documents and Settings\c\My Documents\JCreator LE\MyProjects;C:\lwjgl-2.6;C:\lwjgl-2.6\jar\AppleJavaExtensions.jar;C:\lwjgl-2.6\jar\jinput.jar;C:\lwjgl-2.6\jar\lwjgl.jar;C:\lwjgl-2.6\jar\lwjgl_test.jar;C:\lwjgl-2.6\jar\lwjgl_util.jar;C:\lwjgl-2.6\jar\lwjgl_util_applet.jar;C:\lwjgl-2.6\jar\lwjgl-debug.jar;C:\lwjgl-2.6\jar\lzma.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_16\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_16\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\j3dcore.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\j3dutils.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.6.0_16\jre\lib\ext\vecmath.jar
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 12:41:19
hmm, you've added all the LWJGL jars to the classpath!  :o

you shouldn't do that and you only need to add lwjgl.jar, try removing all the other lwjgl jars.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 12:48:17
I only added the lwjgl.jar and in the "add path" settings I added the path to C:\lwjgl-2.6 and got these errors when compiling:

package org.lwjgl.util.glu does not exist

cannot find symbol method gluOrtho2D(float,int,float,int)


edit:: I added the lwjgl_util.jar file too and then I got the first error I posted.
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 13:28:09
the error in your first post? or the Could not initialize class org.lwjgl.opengl.Display one?
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 13:41:53
This one.

--------------------Configuration: game - JDK version 1.6.0_16 new tool - <Default>--------------------
java.lang.NoClassDefFoundError: command
Caused by: java.lang.ClassNotFoundException: command
   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: command.  Program will exit.
Exception in thread "main"
Process completed.
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 13:45:26
its still looking for a class named 'command' and your getting that error because its not finding it. As mentioned this doesn't relate to any LWJGL specific issue and you should check the way you are launching the file from your IDE. Personally I use Eclipse, so can't really tell why your IDE would produce such an issue.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 13:57:20
I did get this to work with eclipse but its a memory hog. The problem I have with eclipse so far is that I tried to compile a file after changing a simple thing like the color of a cube and I cannot get it to recompile after the first try. I guess this would be off topic but anyways how do you think I would go about finding this "command" problem. The word is no where in the code and I tried googling that last error and I must be the first person ever to get this error since it led back here.
Title: Re: JCreator LE issues
Post by: kappa on January 05, 2011, 14:12:39
with eclipse you shouldn't need to compile any thing manually, you just write the code, click save and hit the run button.

As for your JCreator IDE (i don't use it so maybe a little off) but you've got to make sure the Runtime Configuration is set correctly, there must be something like setting 'Run Application', try right clicking the mian class to see if there some option to change it.
Title: Re: JCreator LE issues
Post by: verthex on January 05, 2011, 14:34:55
I did find this http://www.jcreator.com/forums/index.php?showtopic=7100&pid=21894&mode=threaded&start=#entry21894 (http://www.jcreator.com/forums/index.php?showtopic=7100&pid=21894&mode=threaded&start=#entry21894)thread on the topic that talks about that and I still have no idea why I get this "command" class problem, but I did make a class called command and then I got this error (its with jinpur.jar included)

--------------------Configuration: Main - JDK version 1.6.0_16 new tool - <Default>--------------------
Keys:
down  - Shrink
up    - Grow
left  - Rotate left
right - Rotate right
esc   - Exit
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/input/Mouse
   at command.destroy(command.java:88)
   at command.main(command.java:55)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.input.Mouse
   at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
   at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
   ... 2 more

Process completed.


EDIT:: I got the netbeans example to work so I'm happy for now, but thanks for at least trying.