Search code examples
javaunsatisfiedlinkerror

Exception UnsatisfiedLinkError


I'm trying to run my project, but I have this exception and I don't know what to do next.

Details: in this project I need to use lib.jar, but this JAR file needs .so files.

Edit

    OpenJDK Server VM warning: You have loaded library /home/david/Retina/ReconocimientoRetina/sdk/libIddk2000jni.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c <libfile>', or link it with '-z noexecstack'.
java.lang.UnsatisfiedLinkError: /home/david/Retina/ReconocimientoRetina/sdk/libIddk2000jni.so: libIddk2000.so: no se puede abrir el archivo del objeto compartido: No existe el archivo o el directorio
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
    at java.lang.Runtime.load0(Runtime.java:809)
    at java.lang.System.load(System.java:1086)
    at com.iritech.iddk.standard.Iddk2000Apis.<clinit>(Iddk2000Apis.java:221)
    at com.iritech.demo.functionCapture.open_device(functionCapture.java:1222)
    at com.iritech.demo.Iddk2000Main.getIris(Iddk2000Main.java:39)
    at com.iritech.demo.Iddk2000Main.main(Iddk2000Main.java:30)
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.iritech.iddk.standard.Iddk2000Apis.getIddkConfigNative(Lcom/iritech/iddk/standard/IddkConfig;)I
    at com.iritech.iddk.standard.Iddk2000Apis.getIddkConfigNative(Native Method)
    at com.iritech.iddk.standard.Iddk2000Apis.getSdkConfig(Iddk2000Apis.java:246)
    at com.iritech.demo.functionCapture.open_device(functionCapture.java:1225)
    at com.iritech.demo.Iddk2000Main.getIris(Iddk2000Main.java:39)
    at com.iritech.demo.Iddk2000Main.main(Iddk2000Main.java:30)

My library

I have gnu/linux (ubuntu 64 bits) enter image description here

EDIT

after the search answers i find this link,i need a argument in "VM Argument" but don't work why??

I have native libraries into project in folder workspace/ReconocimientoRetina/sdk/files.so

enter image description here


Solution

  • Solution.

    I solved my problem using this steaps

    first

    1-Add to LD_LIBRARY_PATH

    export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/foobar/lib
    

    2-Rebuild cache

    Open the /etc/ld.so.conf as sudo and add a new line with the library directory. In this case, we add /opt/foobar/lib.

    3- Rerun ldconfig to rebuild the cache:

    sudo ldconfig
    

    4-Check if the shared library cache now includes the shared libraries from the new directory:

    ldconfig -p
    

    More information see this tutorial https://codeyarns.com/2014/01/14/how-to-add-library-directory-to-ldconfig-cache/

    enter image description here