开发者

Unsatisfied Link Error Help Java JNI Eclipse

开发者 https://www.devze.com 2023-03-30 21:52 出处:网络
Hi I am trying to run a project in eclipse and am getting the runtime error: Exception in thread \"main\" java.lang.UnsatisfiedLinkError: mywrapperclass.nativemethod()V

Hi I am trying to run a project in eclipse and am getting the runtime error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: mywrapperclass.nativemethod()V

I only get the error code when I call a native method in the wrapper class from my main. I have looked around on many forums and blogs/websites and haven't been able to fix this. Debug and my browsing have me led me to thinking that the problem lies 开发者_开发问答in the project not being able to find the native methods within the dll.

I had a lot of trouble getting eclipse to find the .dll and eventually solved this by placing the dll in the system32 folder.

Thanks in advance


Project > Properties > Java Build Path

Click on the arrow of the JAR that needs the DLL library.

Native library location

You have to specify the location of the DLL library.


Easiest way to bundle the dlls with eclipse plugin is

create a folder structure under the plugin like this "os/win32/x86" for x86 architecture and place your dlls there.

and load the libraries like this in your plugin code System.loadLibrary("Dll name");


  1. open .classpath in the project location
  2. Set the dll path as "value" for "CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" attribute
0

精彩评论

暂无评论...
验证码 换一张
取 消