problem with JNI on netBeans
Hi !
After a search on the forum, I request your help about a little JNI app developped to work with a 3D sensor. The research team in which I work use to working with Eclipse IDE, and this JNI appliation work on it. However, impossible to find a way on NetBeans... I get an exception :
Exception in thread "main" java.lang.UnsatisfiedLinkError:
materiel.videoproj.JNIsiapp.SiInitialize()I
at materiel.videoproj.JNIsiapp.SiInitialize(Native Method)
at materiel.videoproj.JNIsiapp.main(JNIsiapp.java:138)
It seems the IDE get the DLL (if I change the name in the loadLibrary method, the exception change) but encounter an error with the native method.
The application (source code + dll + java code) could be find on ftp :
ftp://ftp-us.3dconnexion.com
login: jni
password: dev1221
Please help me too find a way !
FloDeTours
# 1
You are getting this error message because NetBeans cannot see your DLL library.
You need to set the working directory in your Netbeans project's properties. You can find this in "run" option in your Project's properties.
Once you have set the working directory, then you need to place your DLL library in that directory.
Another option is to place your DLL library in the Path where java libraries are.
nt60a at 2007-7-10 13:06:41 >

# 2
Library loading seems to continue to be a problem. There are two things to consider. First if you wrote the C/C++ code (like in the tutorials) then you compile it into a dll. This is the only dll you have to worry about. It will get loaded by your Java code using loadLibrary.
This method is going to look for the dll on the path java.library.path. If you don't set this, it is equal to the system path. I like to keep everything inside my project so I put alll dlls in a directory off my project root called "native". So I set java.library.path to "native". In any case it should point to the location of the dll if it is not on the system path.
Second if you have a 3rd party dll then you also have a JNI dll. The JNI dll is the one that loadLibrary loads, so the above applies to it. The third party dll is loaded on the C/C++ side, which know nothing about java.library.path. I only knows system path. This means that the location of this dll must be in that path. You can add the location to the system path permanently or use the IDE project setting to add it only inside the project scope.
When you deploy the app you will need to supply the various path settings in the launching code.
Jim