JNI dependent libraries(JNI 依赖库)
问题描述
我正在通过 JNI 运行一个库(我没有编写它),并且在内部它调用了另一个 DLL.除非我将另一个 DLL 的路径放在系统 PATH 变量上(我在 Windows XP 上),否则我会收到一条错误消息找不到依赖库".我希望能够在 java 命令行上处理这个问题,我已经尝试将它添加到 -Djava.library.path 和类路径中,但都没有工作(我希望 -Djava.library.path 工作但不是类路径,但都没有工作).有没有办法做到这一点?
I'm running a library via JNI (I didn't write it), and internally it calls another DLL. I get an error saying "Can't find dependent libraries" unless I put the path of the other DLL on the system PATH variable (I'm on Windows XP). I'd like to be able to handle this on the java command line, and I've already tried adding it to -Djava.library.path and to the classpath, neither which worked (I expected -Djava.library.path to work but not classpath, but neither worked). Is there a way to do this?
谢谢,
杰夫
推荐答案
- 如果您的 DLL 名称为MyNativeDLL.dll",那么您应该在 LoadLibrary 调用中使用MyNativeDLL".
- 使用Dependency Walker检查是否有MyNativeDLL.dll需要的文件
- 如果有,请将它们包含在与 MyNativeDLL.dll 相同的文件夹中 - 你可以尝试将其他所需文件放入 System32 文件夹中.
- If you have a DLL name 'MyNativeDLL.dll' then you should use 'MyNativeDLL' in your LoadLibrary call.
- Use Dependency Walker to check if there are any files required by MyNativeDLL.dll
- If there are, include them in the same folder as MyNativeDLL.dll - one you get it working try putting the additional required files in System32 folder.
这篇关于JNI 依赖库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:JNI 依赖库


- Eclipse 的最佳 XML 编辑器 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 获取数字的最后一位 2022-01-01
- 转换 ldap 日期 2022-01-01
- 未找到/usr/local/lib 中的库 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01