The Short Story
This post describes a solution that has worked for me when I get a an UnsatisfiedLinkError on Windows using MingW, while developing a JNI library.The Long Story
Java Native Interface (JNI) development on Windows is extremely annoying. There are all kinds of land mines strewn randomly about the landscape to snare the wary and unwary alike. Any one of these issues can require hours of hair-tearing in order to get things to a working state.After dealing with enough of these, I decided to post some of the solutions I've found in order to save others from premature baldness. For today's entertainment, I have selected the infameous UnsatisfiedLinkError.
java.lang.UnsatisfiedLinkError: no found in java.library.path
This is caused by not having the DLL that contains your C/C++ code in the path that Java is using to find it. If you have this problem, try this: - Bring up the properties for the project containing the native declarations
- From the properties dialog, bring up the build path for the project.
- From the build path properties, edit the native libraries location for the project.
- From the resulting dialog, select the folder where your DLLs live
Bring up the properties for the project containing the native declarations
For example:
For the CLIPC project, this is clipc-java. You can be sure by selecting the Java project that contains the .java files with declarations like this one:
From the properties dialog, bring up the build path for the project.
For example:
From the build path properties, edit the native libraries location for the project
For example:
From the resulting dialog, select the folder where your DLLs live
For example, this tells Eclipse to look in the workspace:
Then this tells Eclipse where to look for the DLL:
No comments:
Post a Comment