Error while loading shared libraries; cannot open shared object file: No such file or directory
I got this problem because my shared libraries depends on another shared library which works improperly.
Tomcat 7 + JNI: UnsatisfiedLinkError: cannot open shared object file: No such file or directory
This answer is less than satisfying, but it was the key to solving my problem. I had to move the statement LD_LIBRARY_PATH=/opt/omitted-sdk-name/linux_x86_64/bin
from $CATALINA_HOME/conf/conf.d/myapp.conf
to $CATALINA_HOME/conf/tomcat.conf
. After I did this, the UnsatisfiedLinkError
disappeared.
Cannot Open Shared Object file - C++ library in Java
Java was able to load the native code for library A
(libA.so
) and when it ran that native code there was a dependency on libB.so
(however, it's in native code at that point - outside of the JVMs control). At that point, you must use the native libraries on the system. The usual mechanism is to set the LD_LIBRARY_PATH
environment variable or use ldconfig
(per the man page) which says in part
ldconfig creates the necessary links and cache to the most recent
shared libraries found in the directories specified on the command
line, in the file /etc/ld.so.conf, and in the trusted directories (/lib
and /usr/lib). The cache is used by the run-time linker, ld.so or ld-linux.so.
JNI can't find shared library after program has been deployed
Thanks to @user2543253 I have solved the problem. I am giving an answer for readers in the future (including me, when I will have the same problem).
java.library.path
was correctly set, because it could load the JNI library. The other libraries (the dependencies) have to be in a directory listed in LD_LIBRARY_PATH
. So when deploying the software, you can either
- install the dependencies in places normally present in
LD_LIBRARY_PATH
or - append a directory to
LD_LIBRARY_PATH
before starting the plugin.
ldd
could be successful in linking the library because it also looks in the current directory. So ldd libMyJNI.so
could succeed while ldd \path\to\libMyJNI.so
may fail. In this case, JNI won't work.
cannot open shared object file, but the library file is just there
Solved by running ldconfig on root. I never used ldconfig before. Why sometimes I need to run it after installed a new .so file, but most times not?
Failed to load the JNI shared Library (JDK)
You need a 64-bit
trio:
64-bit
OS64-bit
Java64-bit
Eclipse
Related Topics
How to Make the Watch Command Interpret Vt100 Sequences
.Bashrc Syntax Error: Unexpected End of File
How to Schedule an R Script Cronjob in a Linux Server
Ignoring Comma in Field of CSV File with Awk
Where Is the 'Sdk' Command Installed for Sdkman
Configuring Oracle Listener to Listen Externally
Using a Command That Needs Backticks to Be Passed as Part of an Argument in Bash
Synchronizing Four Shell Scripts to Run One After Another in Unix
Sshpass: Command Not Found Error
How to Break an Arbitrary Tcp/Ip Connection on Linux
What Are Some Conditions That May Cause Fork() or System() Calls to Fail on Linux
How to Join a Thread in Linux Kernel
What's the Difference Between 'Push' and 'Pushq' in At&T Assembly
Cron Error with Using Backquotes
How to Disable Specific Warning When -Wall Is Enabled
Why Is Execution Time of a Process Shorter When Another Process Shares the Same Ht Core