JCreator LE issues

Started by verthex, January 05, 2011, 10:19:00

Previous topic - Next topic

verthex

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
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

and I tried to compile the code on this page 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?

jediTofu

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.
cool story, bro

verthex

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.

kappa

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.

verthex

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.

kappa

ok now that error simply means that lwjgl.jar is not setup correctly as an external jar, double check that.

verthex

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.

kappa

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.

verthex

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

kappa

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.

verthex

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.

kappa

the error in your first post? or the Could not initialize class org.lwjgl.opengl.Display one?

verthex

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.

kappa

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.

verthex

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.