UnsatisfiedLinkError while accessing a Native meth

2019-09-13 10:08发布

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.

1条回答
Lonely孤独者°
2楼-- · 2019-09-13 10:44

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

查看更多
登录 后发表回答