koleror
koleror

Reputation: 347

java3d not working on mac mountain lion


I've been trying for hours now to make java 3d work on my macbook and I can't figure out what's wrong with it... Here is what I've done:
- I downloaded java3d 1.5 and replaced the original files in /System/Library/Java/Extensions.
- I then installed JOGL following a tutorial in the same (...)/Java/Extensions folder.
- As it still did not work, I decided to try the original version of java3d so I renamed the files.

I'm working on a Mac os x mountain lion with java 1.7.0_07 Here is a result of a java -version:

    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b10)
    Java HotSpot(TM) 64-Bit Server VM (build 23.3-b01, mixed mode)

Here is the content of my Java/extensions folder:

    AppleScriptEngine.jar   gluegen-rt.jar          j3dutils.jar.new        libAppleScriptEngine.jnilib libgluegen-rt.jnilib            libnewt.jnilib
    MRJToolkit.jar          j3daudio.jar            jai_codec.jar           libJ3D.jnilib               libjogl_desktop.jnilib          mlibwrapper_jai.jar
    QTJava.zip              j3dcore.jar             jai_core.jar            libJ3DAudio.jnilib          libmlib_jai.jnilib              vecmath.jar
    dns_sd.jar              j3dcore.jar.new         jogl-all.jar            libJ3DUtils.jnilib          libnativewindow_awt.jnilib      vecmath.jar.new
    gluegen-java-src.zip    j3dutils.jar            jogl-java-src.zip       libQTJNative.jnilib         libnativewindow_macosx.jnilib

I can compile java 3d codes with javac but here is the result when I try to launch it:

    $> java Hello3d
    JavaVM WARNING: JAWT_GetAWT must be called after loading a JVM
    AWT not found
    Exception in thread "main" java.lang.NoClassDefFoundError: apple/awt/CGraphicsDevice
        at javax.media.j3d.GraphicsConfigTemplate3D.<clinit>        (GraphicsConfigTemplate3D.java:55)
        at com.sun.j3d.utils.universe.SimpleUniverse.getPreferredConfiguration(SimpleUniverse.java:368)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:348)
        at com.sun.j3d.utils.universe.Viewer.<init>(Viewer.java:298)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:215)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:177)
        at com.sun.j3d.utils.universe.SimpleUniverse.<init>(SimpleUniverse.java:88)
        at Hello3d.<init>(Hello3d.java:13)
        at Hello3d.main(Hello3d.java:27)
    Caused by: java.lang.ClassNotFoundException: apple.awt.CGraphicsDevice
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        ... 9 more

The java class that I'm trying to launch comes from the official tutorial.

Do you have any idea how I could fix this?
Thanks for your help!

Upvotes: 2

Views: 5256

Answers (1)

hharrison
hharrison

Reputation: 81

I'm afraid that Java3D 1.5 is incompatible with newer versions of OSX, there's nothing you can do.

I've forked the Java3D code and replaced the native code backends with a JOGL2 backend

You can find information about installing JOGL2 on OSX here (where there is also a Java3d forum available): http://jogamp.org/

And you can get prebuilt jar files for my Java3d here (under downloads):

https://github.com/hharrison/

(j3d-core, j3d-utils, vecmath)

Fair warning, this only works with Java6 on OSX currently, I've been trying to debug the problems with Java7 on OSX, but have no ETA for a solution.....good luck!

Upvotes: 8

Related Questions