3

I tried installing openjdk6, openjdk7, oracle8... But always the same error when I want to execute java, for example with java -version:

java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

I tried with symbolic links trying to get to recognize libjli.so but it didn't work

After uninstalling all versions, following the steps shown here How to completely uninstall Java? , and installing again, can't make the error disappear. Even if I uninstall it all again, if I write in terminal java -version it stills throw me the same error.

I'm doing all of this with user sudo.

Thank you

EDIT: Using Ubuntu 14.04 LTS Server

EDIT 2: Installing Openjdk7, Oracle7 and Oracle8, using update-alternatives --config java tells me that (in Spanish, but I'll try to translate, 3 lines of information)

"there is only one alternative in the group of java links in /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java Nothing to configure."

"update-alternatives: warning: forcing reinstallation of alternative /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java because the Java links' group is broken"

"update-alternatives: warning: /usr/bin/java will not be substituted by a link"

3

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})
  • I'm presuming the accepted solution fixes it because it creates a symbolic link instead of the copy or hard-link of the java binary.. – maniac Jun 21 '18 at 22:29
  • A variant of the symbolic link fix worked in my case. – TripeHound Feb 5 at 11:56
2

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.

1

I meet this issue in a chroot environment, and fix it by this action

mount /dev /myroot/dev
mount /proc /myroot/proc
0

I encountered the same question on CentOS when I installed the jdk1.8 .

I solved it by:

first, you should give the file execute permission,then install and config it.

chmod a+x jdk-8u151-linux-x64.tar.gz

actually,the libji.so file is in the directory

jdk1.8.0_151/jre/lib/amd64/jli/libjli.so
  • 4
    Why would giving execute permission on a archive file be relevant? – vidarlo Nov 12 '17 at 9:47
0

what working with me is not using the java under

$JAVA_HOME/bin/

but the usage of the java under

$JAVA_HOME/jre/bin

which already has a link to the missing lib .

This happened for me when using oracle jdk 8 v 191 along with eclipse

and it act the same for openjdk you may use

/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.