Search code examples
javadlljava-native-interfaceunsatisfiedlinkerror

java.lang.UnsatisfiedLinkError even on setting -Djava.library.path


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.


Solution

  • 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