在 OS X 10.6 中将 VTK 5.4.2 与 Java 结合使用
有人在 OS X 下使用 VTK 5.4.2 成功运行过 Java 代码吗?
我已经从源代码安装了 VTK 5.4.2,并针对 Java 和共享库进行了配置。 vtk.jar 文件按预期生成,Java 程序编译正确。但是,在执行时,一旦包装类调用底层 *.dylib 库,似乎只加载第一个库,并且找不到其依赖项,即使它们与加载的第一个库位于同一目录中。
使用 Netbeans 运行时,我收到的错误是:
线程“main”中出现异常 java.lang.UnsatisfiedLinkError: /usr/lib/java/libvtkFilteringJava.dylib: 未加载库:libvtkCommonJava.5.4.dylib
引用自:/usr/lib/java/libvtkFilteringJava.dylib 原因:在 java.lang.ClassLoader$NativeLibrary.load(Native Method) 处找不到图像
有什么想法吗?
谢谢- 卡洛斯
Has anybody successfully ran any Java code using VTK 5.4.2 under OS X?
I've installed VTK 5.4.2 from source, configured for Java and shared libraries. The vtk.jar file is generated as expected, and the Java program compiles correctly. However, when executing, as soon as the wrapper classes call the underlying *.dylib libraries, it appears that only the first library loads, and its dependencies are not found even if they are in the same directory as the first library loaded.
When running using Netbeans, the error I am getting is:
Exception in thread "main"
java.lang.UnsatisfiedLinkError:
/usr/lib/java/libvtkFilteringJava.dylib:
Library not loaded: libvtkCommonJava.5.4.dylib
Referenced from: /usr/lib/java/libvtkFilteringJava.dylib
Reason: image not found at java.lang.ClassLoader$NativeLibrary.load(Native Method)
Any ideas?
Thanks-
Carlos
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果为 System.setProperty("java.library.path"); 添加 System.outprintln;它是否包含 ibvtkCommonJava.5.4.dylib 所在的目录?
另外,您是否在计算机上混合运行 32/64 位?...如果是,则编译的库是否与您正在使用的 VM 相同(64 位 VM + 64 位库或 32 位 VM 和32 位库)。
这里讲的是库路径:
http://www.java-tips.org/other-api-tips/jni/simple-example-of-using-the-java-native-interface.html
If you add a System.outprintln for System.setProperty("java.library.path"); does it include the directory where ibvtkCommonJava.5.4.dylib?
Also are you running a mix of 32/64 bit on the machine?... and if so is the library compiled for the same as the VM you are using (64-bit VM + 64-bit library or 32-bit VM and 32-bit library).
This talks about the library path:
http://www.java-tips.org/other-api-tips/jni/simple-example-of-using-the-java-native-interface.html