I am trying to use jME Physics to simulate a Vehicle. At the moment the only proper way to do it is by using ODEJava. I have tried to use jBullet, but there are problems with the rotational axis. So I thought "Just stick to what is already there", it est:
But on my Macbook, it doesn't work. I have followed all the instructions to set up jME Physics and using the native libraries, but I always get the following error:
21.11.2009 18:50:36 org.odejava.Odejava <clinit>
SCHWERWIEGEND: Native code library (32 and 64 bit library) failed to load: java.lang.UnsatisfiedLinkError: /Users/Xerxes/Programming/Eclipse.Workspace/jME Physics 2/impl/ode/lib/libodejava.jnilib: no suitable image found. Did find: /Users/Xerxes/Programming/Eclipse.Workspace/jME Physics 2/impl/ode/lib/libodejava.jnilib: no matching architecture in universal wrapper
java.lang.UnsatisfiedLinkError: /Users/Xerxes/Programming/Eclipse.Workspace/jME Physics 2/impl/ode/lib/libodejava.jnilib: no suitable image found. Did find: /Users/Xerxes/Programming/Eclipse.Workspace/jME Physics 2/impl/ode/lib/libodejava.jnilib: no matching architecture in universal wrapper
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1878)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1795)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at org.odejava.Odejava.<clinit>(Odejava.java:88)
at com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory.getImplementationVersion(OdePhysicsSpace.java:188)
at com.jmex.physics.PhysicsSpace.scanAvailableImplementations(PhysicsSpace.java:373)
at com.jmex.physics.PhysicsSpace.create(PhysicsSpace.java:340)
at com.jmex.physics.util.SimplePhysicsGame.initSystem(SimplePhysicsGame.java:91)
at com.jme.app.BaseGame.start(BaseGame.java:70)
at com.jmetest.physics.vehicle.TestAdvancedVehicle.main(TestAdvancedVehicle.java:166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jmetest.TestChooser.start(TestChooser.java:465)
at com.jmetest.physics.TestChooser.main(TestChooser.java:47)
21.11.2009 18:50:36 com.jmex.physics.PhysicsSpace scanAvailableImplementations
WARNUNG: Failed to use physics implementation 'com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory' due to Exception/Error: java.lang.UnsupportedOperationException: Failed to load natives
java.lang.UnsupportedOperationException: Failed to load natives
at org.odejava.Odejava.init(Odejava.java:125)
at com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory.getImplementationVersion(OdePhysicsSpace.java:188)
at com.jmex.physics.PhysicsSpace.scanAvailableImplementations(PhysicsSpace.java:373)
at com.jmex.physics.PhysicsSpace.create(PhysicsSpace.java:340)
at com.jmex.physics.util.SimplePhysicsGame.initSystem(SimplePhysicsGame.java:91)
at com.jme.app.BaseGame.start(BaseGame.java:70)
at com.jmetest.physics.vehicle.TestAdvancedVehicle.main(TestAdvancedVehicle.java:166)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at jmetest.TestChooser.start(TestChooser.java:465)
at com.jmetest.physics.TestChooser.main(TestChooser.java:47)
Caused by: java.lang.UnsatisfiedLinkError: /Users/Xerxes/Programming/Eclipse.Workspace/jME Physics 2/impl/ode/lib/libodejava.jnilib: no suitable image found. Did find: /Users/Xerxes/Programming/Eclipse.Workspace/jME Physics 2/impl/ode/lib/libodejava.jnilib: no matching architecture in universal wrapper
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1878)
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1795)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1045)
at org.odejava.Odejava.<clinit>(Odejava.java:88)
... 12 more
I have read in a forum, that the problem can be solved by recompiling the natives on my machine. Is somewhere an instruction/walkthrough how to do that?
If you have other recommendations how to solve that problem, please just let me know.
I have followed your procedure to generate a jnilib-file. It has taken me a whole day, but in the end I got that file. I don’t know if I have done it all the right way. I have also installed/updated several other tools, before I could actually execute the sh-script.
With eclipse, I have put that jnilib-file into “jME Physics 2/impl/ode/lib” (so eclipse is also aware of that file), updated the native reference of odejava-jni.jar and executed “TestAdvancedVehicle.java”.
But it still doesn’t work…I still get the following output
23.11.2009 18:53:22 org.odejava.Odejava <clinit>
SCHWERWIEGEND: Wrong native version! Expected 0.3.1, but found 0.3.2
23.11.2009 18:53:22 com.jmex.physics.PhysicsSpace scanAvailableImplementations
WARNUNG: Failed to use physics implementation 'com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory' due to Exception/Error: java.lang.UnsupportedOperationException: Failed to load natives
java.lang.UnsupportedOperationException: Failed to load natives
at org.odejava.Odejava.init(Odejava.java:125)
at com.jmex.physics.impl.ode.OdePhysicsSpace$OdeFactory.getImplementationVersion(OdePhysicsSpace.java:188)
at com.jmex.physics.PhysicsSpace.scanAvailableImplementations(PhysicsSpace.java:373)
at com.jmex.physics.PhysicsSpace.create(PhysicsSpace.java:340)
at com.jmex.physics.util.SimplePhysicsGame.initSystem(SimplePhysicsGame.java:91)
at com.jme.app.BaseGame.start(BaseGame.java:70)
at com.jmetest.physics.vehicle.TestAdvancedVehicle.main(TestAdvancedVehicle.java:166)
Caused by: java.lang.UnsatisfiedLinkError: Wrong native version! Expected 0.3.1, but found 0.3.2
at org.odejava.Odejava.<clinit>(Odejava.java:105)
... 6 more
23.11.2009 18:53:23 class com.jmetest.physics.vehicle.TestAdvancedVehicle start()
SCHWERWIEGEND: Exception in game loop
java.lang.UnsupportedOperationException: 2x rotational axis joints are unsupported in this implementation. Problematic Joint: com.jmex.physics.impl.jbullet.joints.JBulletJoint@4a57ea52
at com.jmex.physics.impl.jbullet.joints.JBulletJoint.unsupported(JBulletJoint.java:348)
at com.jmex.physics.impl.jbullet.joints.JBulletJoint.buildConstraint(JBulletJoint.java:199)
at com.jmex.physics.impl.jbullet.JBulletPhysicsSpace.update(JBulletPhysicsSpace.java:576)
at com.jmex.physics.impl.jbullet.JBulletPhysicsSpace.update(JBulletPhysicsSpace.java:533)
at com.jmex.physics.util.SimplePhysicsGame.update(SimplePhysicsGame.java:142)
at com.jme.app.BaseGame.start(BaseGame.java:84)
at com.jmetest.physics.vehicle.TestAdvancedVehicle.main(TestAdvancedVehicle.java:166)
How can I check that the jnilib-file is built correctly?
I think the interesting part is:
Caused by: java.lang.UnsatisfiedLinkError: Wrong native version! Expected 0.3.1, but found 0.3.2
at org.odejava.Odejava.<clinit>(Odejava.java:105)
Odejava.java is in the folders downloaded from the repository by the sh-script. It is in
Welcome to the jungle, it took me TWO whole days, so you're better than I am.
0.3.2 seems to be correct, as that is the same version that I compiled. So right off, since it loaded and found that it was version 0.3.2, I think you have success. Now, the odejava.jar is looking to load version 0.3.1, so you need to build a 0.3.2 version of that to match your updated native.
Honestly, I don't remember how it all ties together. I'll poke around and see if I can remember anything and report back.
First of all, thanks for your help and the files! I have tried your odejava-jni.jar, but unfortunately it doesn't work. There are some building problems, when I use your jar:
This is a continuation of log file /Users/Xerxes/Programming/Eclipse.Workspace/.metadata/.bak_0.log
Created Time: 2009-11-24 17:09:29.206
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.206
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/Odejava.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.207
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/Ode.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.207
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeConstants.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.208
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeJNI.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.209
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_a_4__float.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.209
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dGeomID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.210
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dGeomTriMeshDataCreate.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.210
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dJointGroupID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.211
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dJointID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:09:29.211
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dMass.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.033
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/Odejava.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.091
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/Ode.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.092
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeConstants.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.092
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeJNI.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.093
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_a_4__float.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.093
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dGeomID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.094
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dGeomTriMeshDataCreate.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.095
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dJointGroupID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.095
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dJointID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.095
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dMass.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.674
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/Odejava.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.675
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/Ode.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.726
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeConstants.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.726
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeJNI.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.727
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_a_4__float.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.727
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dGeomID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.728
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dGeomTriMeshDataCreate.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.728
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dJointGroupID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.729
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dJointID.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:07.729
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/SWIGTYPE_p_dMass.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:31.912
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/Odejava.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:31.913
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/Ode.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
!ENTRY org.eclipse.jdt.core 2 0 2009-11-24 17:13:31.914
!MESSAGE The Java indexing could not index jME Physics 2/impl/ode/lib/odejava-jni.jar|org/odejava/ode/OdeConstants.class. This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
.
.
.
!ENTRY org.eclipse.core.resources 4 2 2009-11-24 17:13:37.208
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
!STACK 0
java.lang.ArrayIndexOutOfBoundsException: 32
at org.eclipse.jdt.internal.compiler.classfmt.MethodInfo.getMethodDescriptor(MethodInfo.java:251)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethod(BinaryTypeBinding.java:403)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.createMethods(BinaryTypeBinding.java:577)
at org.eclipse.jdt.internal.compiler.lookup.BinaryTypeBinding.cachePartsFrom(BinaryTypeBinding.java:327)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.createBinaryTypeFrom(LookupEnvironment.java:640)
.
.
.
The interesting part in that output is:
This .class file doesn't follow the class file format specification. Please report this issue against the .class file vendor
And when I execute TestAdvancedVehicle.java, the class-files in your jar can not be used:
Exception in thread "main" java.lang.NoClassDefFoundError: com/jmetest/physics/vehicle/TestAdvancedVehicle
Caused by: java.lang.ClassNotFoundException: com.jmetest.physics.vehicle.TestAdvancedVehicle
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:319)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:330)
at java.lang.ClassLoader.loadClass(ClassLoader.java:254)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:399)
How can your class-files not follow the format specification?!?!? I have read that for the first time :). Any guesses?
Just a wild guess: Maybe changing the jar-file to a txt-file and vice versa does effect the format structure ;). Can you put the jar in a zip-file and post it again?
On MacOSX, the jnilib files often do not get loaded from the given classpath by programs, Netbeans for example has this problem as well.
To use jnilibs on OSX, put them globally in /Library/Java/Extensions
Also, the standard Snow Leopard Java is 64bit and needs 64bit jnilibs. Maybe try setting the 32-bit java VM as the main one in Java-Settings…
Regards,
Normen
Edit: Btw, Stupid Apple left only Java 1.6 on SnowLeopard, which makes it impossible to compile 1.5 Java programs out of the box, and these are the only ones that run on all Leopard machines (PPC, Intel32bit) … Oh, the Mac-Java woes… I'm sticking to Leopard for now…
Would be nice if the prebuilt libs in jmephysics2 on googlecode were java 1.5 binaries (jbullet etc). Because now I have to compile them myself…
I tried your approach to, by putting the jnilib-file in /Library/Java/Extensions, but it doesn't work neither.
I have tried several odejava-jni.jar's by now, but the only one, which makes no problems in the code (no missing .class-files etc.), is the one from the SVN-Repository http://jmephysics.googlecode.com/svn.
That is really a pain. Maybe I will just switch to Windows XP, when I use the physics…unfortunately, because I really love OSX! But I need to make progress with my work.
Well, ODEJava runs on Leopard for me. 32bit Java 1.5
Did you try changing 64bit to 32bit java in Utilities/Java Settings?
I suppose the compiled jnilib version is 32 bit and that one set of java classes you have is messed up, not a different version. There have not been new versions in the last few years, so there are probably no different versions available anyway…
Thank you for your comment! The Java Version was the reason for all the problems. I thought that Java5 would also be installed on my Macbook, but that is not the case. In /System/Library/Frameworks/JavaVM.framework/Versions/ there is also a reference to Java 1.5.0. But that reference is actually referencing Java 1.6.0!
So even if you set Eclipse to use Java 1.5.0 you are still using Java 1.6.0!!! That's what I did right at the beginning...........that illusion set up by Apple is really annoying.
Anyway, I will just describe what I did to solve the problem:
Follow that WikiGuide to install Java 5 on OSX 10.6: http://wiki.oneswarm.org/index.php/OS_X_10.6_Snow_Leopard
You might need to checkout jME Physics again from the repository (I had some problems to run the sample-programs)
Nice, good to hear theres a way to install Java 1.5 on SnowLeopard, maybe I upgrade sooner than I thought
Trying with a Snow Leopard MacBook from work, I got ODEJava to run by simply switching to 32bit Java 1.6 in the global java settings. Of course you have to restart your IDE to have it run in 32bit after you do that.