Java: Error while loading shared libraries: libjli.so
I meet this issue in a chroot environment, and fix it by this action
mount --bind /dev /myroot/dev
mount --bind /proc /myroot/proc
Finally found the solution:
rm /usr/bin/java
update-alternatives --config java
Now it works by removing that binary, it was causing problems. Doesn't know if update-alternatives
had any effect, but the last warning didn't show.
I encountered this problem when I made a hard-link to the java executable and tried to execute it. I'm presuming it was looking for its libraries using a relative path to the executable binary.
I tried both of these options, and each worked for me:
- Putting the hard-link in the same directory as the java binary and running it from there (/usr/lib/jvm/openjre-8/bin in my case)
- Creating and using a symbolic link instead of a hard link
(ie. with
ln -s $(which java) /usr/bin/${my_binary_name}
)