访问 Native 方法时出现 UnsatisfiedLinkError
我正在使用 Eclipse,当我尝试从 ExtractImage.dll
文件访问本机方法时,出现以下错误
java.lang.UnsatisfiedLinkError: getVertices
at com.coimp.application.ExtractImage.getVertices(Native Method)
- 我已将 dll 添加到以下路径 -
C:\Program Files\Java\jre1.5.0_10\bin;
. //current workspace
C:\WINDOWS\system32;
C:\WINDOWS;
并且我已使用此方法加载库-
System.loadLibrary("ExtractImage");
还尝试过 -
System.load("c:\ExtractImage.dll");
将 .dll 文件添加到 NativeLibrary 路径
相同的代码适用于我的 Web 应用程序。
极客们,有什么解决这个问题的猜测吗? 感谢您即将到来的支持。
I am using eclipse and getting the below error when I try to access a native method from a ExtractImage.dll
file-
java.lang.UnsatisfiedLinkError: getVertices
at com.coimp.application.ExtractImage.getVertices(Native Method)
I have added the dll to below paths -
C:\Program Files\Java\jre1.5.0_10\bin;
. //current workspace
C:\WINDOWS\system32;
C:\WINDOWS;
and I have used this method to load the library -
System.loadLibrary("ExtractImage");
Also tried with -
System.load("c:\ExtractImage.dll");
Adding the .dll file to NativeLibrary path
The same code works on my web application.
Geeks, any guesses to fix this problem ?
Thanks for upcoming support.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在“参数”选项卡的“运行配置...”选项中,在“VM 参数”中指定“-Djava.librar.path=YOUR_DIR_TO_DLL”
如果库与 PATH 中不存在的其他 DLL 存在依赖关系,则还应该包括这些目录(用 ; 分隔)
更新
如果也失败,您可以修改 PATH 环境变量(在“环境”选项卡中)。我建议您编辑变量(添加目录)并选择“将环境附加到本机环境”选项(底部的单选按钮)。
In the "Run Configuration..." options in the "Arguments" tab specify in "VM Arguments" "-Djava.librar.path=YOUR_DIR_TO_DLL"
If the library has dependencies with other DLLs not present in the PATH, you should also include those directories (separated by ;)
Update
If that fails too you can modifiy PATH environment variable (in tab "Environment"). I would recommend you that you edit the variable (adding your directories) an leave the option "Append environment to native environment" selected (radio buttons at bottom).