使用 PyDev 配置 Jython、处理和 OpenGL
我正在尝试使用 Eclipse/PyDev 在 MacOSX Snow Leopard 上使用 Jython 编写处理应用程序。简单的草图工作得很好,但是当我尝试使用 OpenGL API 时,应用程序崩溃并抛出此错误:
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
请注意,这是一个运行时错误,而不是构建错误。看起来 JVM 找不到 jogl 库,尽管我已将它们添加到项目设置中的外部库中。事实上,我已经添加了以下所有内容:
- core.jar
- jogl.jargluegen
- -rt.jar
- opengl.jar
- libgluegen-rt.jnilib
- libjogl_awt.jnilib
- libjogl_cg.jnilib
- libjogl.jnilib
检查Python路径表明所有这些文件都是事实上在 Python 路径上,但是当我使用以下命令查看 Java 路径时:
System.getProperty("java.library.path")
» » 我只看到这个 » »
/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib /java
显然这些库的链接有问题。可能是什么?
更新: 我发现问题是 .jar 文件的本机库的路径没有添加到 Java 路径中。 PyDev 似乎不支持像标准 Eclipse Java 项目设置那样设置链接 .jar 文件的本机库的路径。因此,作为修复,我能够通过运行配置中的 VM 参数添加本机库的目录。
更新2: 我写了一篇关于环境配置的文章: http://bit.ly/yHjIw9
I am experimenting with the idea of writing Processing apps with Jython on MacOSX Snow Leopard using Eclipse/PyDev. Simple sketches are working pretty well, but when I attempt to use the OpenGL APIs the app crashes and throws this error:
Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
Note that this is a runtime error, not a build error. It looks like the JVM can't find the jogl libs, though I have added them to the External Libraries in the project settings. In fact I've added all of the following:
- core.jar
- jogl.jar
- gluegen-rt.jar
- opengl.jar
- libgluegen-rt.jnilib
- libjogl_awt.jnilib
- libjogl_cg.jnilib
- libjogl.jnilib
Inspecting the Python path reveals that all of these files are in fact on the Python path but when I look at the Java path using:
System.getProperty("java.library.path")
» » I see only this » »
/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
Clearly something is wrong with the linking of these libs. What could it be?
UPDATE:
I found the issue to be that the paths to the native libraries for the .jar files were not being added to the Java path. PyDev does not appear to accomodate setting the path to the native library of a linked .jar file like the standard Eclipse Java project settings do. So as a fix I was able to add the directory of the native libs throug a VM argument in the Run Configurations.
UPDATE 2:
I've written an article on the env configuration: http://bit.ly/yHjIw9
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我还回复了一条推文,但我相信答案是将 LD_LIBRARY_PATH 环境变量设置为指向包含本机库的文件夹。 (编辑:抱歉,在 OSX 上这是 DYLD_LIBRARY_PATH)
I replied also with a tweet, but I believe the answer to be setting the LD_LIBRARY_PATH environment variable to point to the folder containing your native libs. (edit: sorry on OSX this is DYLD_LIBRARY_PATH)