尝试使用 JOGL Swing 测试代码时未找到 JVMUtil class

JVMUtil class not found when attempting to use JOGL Swing test code

当我尝试 运行 JOGL Swing test code 时,我收到一条错误消息:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/nativewindow/impl/jvm/JVMUtil
    at javax.media.opengl.GLProfile.<clinit>(GLProfile.java:625)
    at com.jojodmo.wizardgame.Main.main(Main.java:34)
Caused by: java.lang.ClassNotFoundException: com.sun.nativewindow.impl.jvm.JVMUtil
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 2 more

我的 Main.java 的第 34 行有这一行,其中 GLProfilejavax.media.opengl.GLProfile:

GLProfile glprofile = GLProfile.getDefault()

这是我第一次在文件中使用 JOGL。我正在使用 JOGL 2.0, and the file I'm using is called jogl-2.0-macosx-universal.zip (I've also tried using version 1.1.1, but get the same result, on top of the fact that its outdated). It's downloaded from java.net,这不是官方的,可能是问题所在,但我不确定。

我正在将 gluegen-rt.jarjogl.all.jar 都导入到 eclipse 中:

并且我将 Native library location 设置为包含 .jnilib.so 文件的文件夹:

问题是我将 swingawt 一起使用,还是其他错误?

与 JOGL 1 有冲突,请卸载它,将其从 JVM and/or 扩展机制使用的目录中删除。 "com/sun" 不再出现在 JOGL 2.3.1(目前为 2015 年 6 月)中。 JOGL 2.0 已过时,jogl.all.jar 同时已重命名为 jogl-all.jar。请按照我们 Wiki 上提供的说明进行操作: http://jogamp.org/wiki/index.php/Setting_up_a_JogAmp_project_in_your_favorite_IDE

P.S: Oracle 于 2009 年 11 月放弃了 JOGL,它一直由 JogAmp 社区积极维护。我负责引擎支持。