I am loading a library into my java code. I have put the library in the sytem 32 folder and I have also set the -Djava.library.path.
Earlier this code was running
try{
System.loadLibrary("resources/TecJNI");
System.out.println("JNI library loaded \n");
}
catch(UnsatisfiedLinkError e){
System.out.println("Did not load library");
e.printStackTrace();
}
but since last week it is showing
java.lang.UnsatisfiedLinkError: no resources/TecJNI in java.library.path.
Is this some file permission issue for the dll that I am loading in the java code OR dll are using by some other application.
Also all other my running applications that were using & loading the same dll in different workspace are not running now.
Could anyone suggest me?
EDIT: I am using -
Djava.library.path="${workspace_loc}/org.syntec.ivb.application/resources;${env_var:PATH}"
in my eclipse vm arguments. I think it is using this.
when comes to load libs in jvm, I like to copy the libs to a temp directory, then load them from the temp directory. here is the code:
Why do you need the additional "resources"?
When using
System.loadLibrary("resources/TecJNI");
you are looking for TecJNI.dll in a subfolder"resources"
of the java.library.path. So if you put C:\windows\system32 on the library-path (which you wouldn't need since it's on the search-path by default) your library should beC:\windows\system32\resources\TecJNI.dll
System.loadLibrary expects library name, not a path. The path to the directory containg the library should be set in PATH (Windows) env variable or in -Djava.library.path