I’ve been messing around for a while now trying to figure out how to get the demos to run under linux. I’ve probably done something very simple wrong, but can’t seem to get them going.
This leaves me with /install and /jme directories. Going into the /jme directory I run ant dist-all which compiles with a fair number of warnings, but no errors. run ant dist-test, same as before. So now I try to run the demos… I have yet to find a command run from either /install or /jme that effectively runs any of the demos.
I can’t remember where I found the demo commands - especially the page that mentioned using the * shortcut if you are using Java 6+. Since I am using Java 6, I used the following command from within the /jme directory. Note: I have replaced the ; with : since I am running Linux.
Nov 9, 2008 2:00:13 AM com.jme.app.BaseGame start
INFO: Application started.
Nov 9, 2008 2:00:13 AM com.jme.system.PropertiesGameSettings <init>
INFO: PropertiesGameSettings created
Nov 9, 2008 2:00:13 AM com.jme.system.PropertiesGameSettings load
WARNING: Could not load properties. Creating a new one.
Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: [Lorg/lwjgl/opengl/DisplayMode;
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2427)
at java.lang.Class.getDeclaredMethod(Class.java:1935)
at java.awt.Component.isCoalesceEventsOverriden(Component.java:5726)
at java.awt.Component.access$100(Component.java:162)
at java.awt.Component$2.run(Component.java:5680)
at java.awt.Component$2.run(Component.java:5678)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Component.checkCoalescing(Component.java:5677)
at java.awt.Component.<init>(Component.java:5646)
at java.awt.Container.<init>(Container.java:245)
at java.awt.Window.<init>(Window.java:320)
at java.awt.Window.<init>(Window.java:466)
at java.awt.Dialog.<init>(Dialog.java:654)
at java.awt.Dialog.<init>(Dialog.java:398)
at javax.swing.JDialog.<init>(JDialog.java:259)
at javax.swing.JDialog.<init>(JDialog.java:193)
at javax.swing.JDialog.<init>(JDialog.java:141)
at com.jme.system.lwjgl.LWJGLPropertiesDialog.<init>(LWJGLPropertiesDialog.java:184)
at com.jme.app.AbstractGame$1.run(AbstractGame.java:215)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.opengl.DisplayMode
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:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
... 28 more
I have tried the longer commands as well, also resulting in a lot of errors. Not really sure what I am doing wrong here. My assumption is that the classpath or library paths are wrong, but at this point I have no clue what else to try. I figured I would get it working in the command line before trying to mess with Geany, Eclipse, or NetBeans.
In case it helps:
OS: Ubuntu 8.04
Java: 1.6.0_07 (Sun Java JDK/JRE, not gjc)
Ant: 1.7.0
Yes, I am using jme2. Forgot to mention I did ant jMe_v2 when I used the antbuildscript. Also correct on the , modifying the classpath to have each directory for the libs works. Thanks for the help, it is much appreciated.
* These are only for jMe_v2! Add "cvs" and "tkcvs" (without quotes) to the list for jMe_v1.
Note: you can also use apt-get install if you like.
** gedit or nano, vim, leafpad, <insert favorite text editor here>.
There are some other things for jMe_v1 as noted on the page with the script. Notably, the username and password used for CVS.
Anyways, hope this helps other people like me that got confused.
If you checked out jme2 from svn you should also be able to run the ant target "run_testchooser" to get a selection list of all test classes to choose from!
Interesting tidbit there. I had haphazardly noticed the run-testchooser target when I was messing with the build.xml, using it as a reference to learn how to make a build.xml forr one of my own little side projects. :D Figured I'd do something productive while taking a break from trying to get the demo's working.
Anyways, when I try to use run-testchooser the actual chooser runs perfectly, but for some reason the demo's mostly do not. Looking at the error messages, it seems to be a similar culprit. The java.library.path doesn't have LWJGL.
[java] Nov 9, 2008 3:45:13 PM class jmetest.effects.TestDynamicSmoker start()
[java] SEVERE: Exception in game loop
[java] java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
[java] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
[java] at java.lang.Runtime.loadLibrary0(Runtime.java:823)
[java] at java.lang.System.loadLibrary(System.java:1030)
[java] at org.lwjgl.Sys$1.run(Sys.java:72)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at org.lwjgl.Sys.doLoadLibrary(Sys.java:65)
[java] at org.lwjgl.Sys.loadLibrary(Sys.java:81)
[java] at org.lwjgl.Sys.<clinit>(Sys.java:98)
[java] at org.lwjgl.opengl.Display.<clinit>(Display.java:128)
[java] at com.jme.system.lwjgl.LWJGLPropertiesDialog$ModesRetriever.run(LWJGLPropertiesDialog.java:682)
[java] at com.jme.app.AbstractGame.getAttributes(AbstractGame.java:231)
[java] at com.jme.app.BaseGame.start(BaseGame.java:64)
[java] at jmetest.effects.TestDynamicSmoker.main(TestDynamicSmoker.java:79)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at java.lang.reflect.Method.invoke(Method.java:597)
[java] at jmetest.TestChooser.start(TestChooser.java:465)
[java] at jmetest.TestChooser.main(TestChooser.java:444)
[java] Nov 9, 2008 3:45:13 PM com.jme.app.BaseSimpleGame cleanup
[java] INFO: Cleaning up resources.
[java] Nov 9, 2008 3:45:13 PM com.jme.system.lwjgl.LWJGLDisplaySystem <init>
[java] INFO: LWJGL Display System created.
[java] Nov 9, 2008 3:45:13 PM com.jme.app.BaseGame start
[java] INFO: Application ending.
All I had to do was change the ; to : - but build.xml should probably be modified to use a property that has its value set base on the OS. So it will auto switch from inserting ; to : based on Win/Mac/*nix. I'm not really certain how to do that at this time, as my experience with ant is literally 1 night of tinkering.
Ow my bad! I can't believe I overlooked that when "fixing" the build.xml.
I'm not so sure what to do about it either, I am an ant novice myself and don't know out of my head how to determine the operating system used in an ant target. Maybe somebody else can help here?
I've been doing some digging and found that when you do a typical pathref like is done for classpath, it automatically converts ; to : appropriately, however in this case it's a string passed as an arg and doesn't. I tried a bunch of ways to get a path to work, but I guess you can't set the environment variable for java.library.path using ant. Only through the arg with a string. Which leaves a convoluted if/then/else wanna be structure as the answer. So this seems to work on Linux - I don't have windows on my box to test it under win/mac/etc.