Search code examples
javalinuxshared-librariesstatic-librariesstatic-linking

-Djava.library.path not linking .so library


I need to link a particular library when executing a .jar application. I have modified the variable LD_LIBRARY_PATH and added (as the first directory) the path of the folder containing the desired library. I have also tried to execute the appplication using the option -Djava.library.path="path_to_.so", but with the same result.

In concrete, the result I am obtaining is:

Exception in thread "main" java.lang.UnsatisfiedLinkError: /.../application/lib64/libshmlib.so: 
/lib64/libc.so.6: version `GLIBC_2.14' not found (required by /.../another_application/lib64/libshmlib.so)

Are there any other options to load libraries besides the mentioned before?


Solution

  • LD_PRELOAD='path/of/lib.so' ./program basically loads that given library before any other when executing the given program. So it is the best option if you need to load a concrete library