访问本机方法时出现UnsatisfiedLinkError [英] UnsatisfiedLinkError while accessing a Native method

查看:71
本文介绍了访问本机方法时出现UnsatisfiedLinkError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用eclipse并尝试从ExtractImage.dll文件访问本机方法时出现以下错误-

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)

我已将dll添加到以下路径-

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");

也尝试过-

System.load("c:\ ExtractImage.dll");

System.load("c:\ExtractImage.dll");

将.dll文件添加到NativeLibrary路径

Adding the .dll file to NativeLibrary path

相同的代码可在我的Web应用程序上工作.

The same code works on my web application.

怪胎,有任何解决此问题的猜测吗? 感谢您的支持.

Geeks, any guesses to fix this problem ? Thanks for upcoming support.

推荐答案

在参数"选项卡的运行配置..."选项中,在虚拟机参数"中指定"-Djava.librar.path = YOUR_DIR_TO_DLL"

In the "Run Configuration..." options in the "Arguments" tab specify in "VM Arguments" "-Djava.librar.path=YOUR_DIR_TO_DLL"

如果该库具有与PATH中不存在的其他DLL的依赖关系,则还应包括这些目录(以;分隔)

If the library has dependencies with other DLLs not present in the PATH, you should also include those directories (separated by ;)

更新 如果仍然失败,则可以修改PATH环境变量(在环境"选项卡中).我建议您编辑变量(添加目录),并保留将环境附加到本地环境"选项(底部的单选按钮).

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).

这篇关于访问本机方法时出现UnsatisfiedLinkError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆