Problem running HelloWorld from Command Line [SOLVED]

Hello,



I apologize in advance if this is a really stupid questions, but I've been searching the forums as well as google to no avail.



I'm trying to start a Java program using jme 1 via the command line. The program has been written and compiled in eclipse. I'm using JRE 6.



Since I got errors starting the program(as soon as I reached the jme-part of the program), I thought I'd start small by trying to start the HelloWorld file from the Tutorial. I tried doing it according to the explanation here:

http://www.jmonkeyengine.com/wiki/doku.php?id=getting_started



CommandLine:


C:/...myPath.../eclipse workspacejmesrc>java -Djava.library.path=../lib -cp ../lib;../bin; jmetest.TutorialGuide.HelloWorld


17-Jun-2009 20:49:47 com.jme.app.BaseGame start
INFO: Application started.
17-Jun-2009 20:49:47 com.jme.system.PropertiesIO <init>
INFO: PropertiesIO created
17-Jun-2009 20:49:47 com.jme.system.PropertiesIO load
WARNING: Could not load properties. Creating a new one.
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: [Lorg/lwj
gl/opengl/DisplayMode;
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getDeclaredMethod(Unknown Source)
        at java.awt.Component.isCoalesceEventsOverriden(Unknown Source)
        at java.awt.Component.access$400(Unknown Source)
        at java.awt.Component$4.run(Unknown Source)
        at java.awt.Component$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.awt.Component.checkCoalescing(Unknown Source)
        at java.awt.Component.<init>(Unknown Source)
        at java.awt.Container.<init>(Unknown Source)
        at java.awt.Window.<init>(Unknown Source)
        at java.awt.Window.<init>(Unknown Source)
        at java.awt.Dialog.<init>(Unknown Source)
        at java.awt.Dialog.<init>(Unknown Source)
        at javax.swing.JDialog.<init>(Unknown Source)
        at javax.swing.JDialog.<init>(Unknown Source)
        at javax.swing.JDialog.<init>(Unknown Source)
        at com.jme.system.lwjgl.LWJGLPropertiesDialog.<init>(LWJGLPropertiesDial
og.java:182)
        at com.jme.app.AbstractGame$1.run(AbstractGame.java:205)
        at java.awt.event.InvocationEvent.dispatch(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.DisplayMode
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 28 more



What really confuses me here, is that I can't really find any more classes or jars in my jme folder that could be missing. They are all in /lib or /bin. Also, it is searching for "Lorg/lwjgl/opengl/DisplayMode" but I can't even find a folder called opengl anywhere on my harddrive, or is this within a jar?(I'm afraid I'm really not understanding things here.)

What also confused me: When I first installed jme with the guide to build jme with eclipse, I got lots of errors all over eclipse saying org.opengl.something couldn't be found. I solved this by adding the jme System Library in addition to the jme required librabry the tutorial told me to create.

That made me think maybe I got the same problem again. Maybe when starting HelloWorld java misses some standart libraries or something?

Anyway, basically, I really have no clue what is wrong, so if you have any hints in the right direction, please tell me.

Thanks in advance!

~Sam~

-cp ../lib;../bin



-cp needs to point to the jars, not to the directory containing the jars.

either use -cp ../bin/*  (java 6 supports wildcards)  or -cp ../bin/jar1.jar;../bin/jar2.jar;../bin/jar3.jar

Thanks for pointing out that Java 6 supports wildcards. That would make life easier.


Well, the lib folder contains my jars, while bin only has classes and it finds the classes just fine. So I changed the lib bit:



java -Djava.library.path=…/lib -cp …/lib/*;…/bin; jmetest.TutorialGuide.HelloWorld



Which worked! Thank you very much, Core-Dump! Just a little * missing and I probably would have searched on for ages.  :smiley:

Glad it works for you, it can be a bit confusing because java.lubrary.path needs to point to a directory and -classpatch needs to point to the jars.

Sun has many great examples and tutorials which explain things pretty good.

http://java.sun.com/docs/books/tutorial/