Win64 - JNI: UnsatisfiedLinkError: Can't find dependent libraries

3.4k views Asked by At

I have a own JNI dll which depends on a few other dlls (Zero MQ to be precise). I have compiled these dependencies on Windows 7(64bit) via Visual Studio. I defined that I get 64-bit dlls.

On the developer machine it works just fine. But if I move those dlls to another machine(also Windows 7 64 Bit) I get the Error mentioned in the title.

I also moved my minigw-64 installation to this machine to compile my dll there. For this, ofcoures, I need all the other dlls as well, and I can compile it sucessfully. But If I start the jar file (where my jni-lib will be loaded) I get this UnsatisfiedLinkError.

I did exactly the same on both PCs. The Path or java.library.path are the same on both.

My start Script looks like this:

set PATH=C:\Path\To\my\dependencies;.;%PATH%
java -jar myjar.jar
pause

Any Ideas what the problem could be?

1

There are 1 answers

5
Thiyagarajan On BEST ANSWER

Check for the following.

1) Make sure that there is no typo in the library name .

incase of linux it should be some thing like

System.load.library("mylib");

then the lib name should be like libmylib.so.

2) You need to add the location of the java library path like

-Djava.library.path="path to your dll location".

3) Make sure that you have compiled your library in the version of Jre you are using i.e ( If you use 64bit Jre you need to compile the dll in 64 bit). Or you can use -d32 or -d64 flags if available in your jre.

4) Make sure that the dll is not in debug mode as it would need the microsoft debug runtime libraries in the machine if so(I have done it quite a few times). If there is any problem with dependencies path walker should help you to identify the dependency problem.