2


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!

4

1 回答 1

8

恐怕Java3D 1.5 与较新版本的OSX 不兼容,您无能为力。

我已经分叉了 Java3D 代码并用 JOGL2 后端替换了本机代码后端

你可以在这里找到关于在 OSX 上安装 JOGL2 的信息(那里还有一个 Java3d 论坛):http: //jogamp.org/

您可以在此处(在下载下)为我的 Java3d 获取预构建的 jar 文件:

https://github.com/hharrison/

(j3d-core, j3d-utils, vecmath)

公平警告,目前这只适用于 OSX 上的 Java6,我一直在尝试在 OSX 上调试 Java7 的问题,但没有解决方案的 ETA ......祝你好运!

于 2012-10-10T02:08:43.377 回答