Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to launch Java:

$ java -version
java: error while loading shared libraries: cannot open shared object file: No such file or directory

$ ldd /usr/lib/jvm/java-6-openjdk/jre/bin/java =>  (0xb779f000) => /usr/lib/ (0xb7780000) => /lib/i686/cmov/ (0xb7767000) => /usr/lib/jvm/java-6-openjdk/jre/bin/../lib/i386/jli/ (0xb7762000) => /lib/i686/cmov/ (0xb775e000) => /lib/i686/cmov/ (0xb7603000)
        /lib/ (0xb77a0000
$ ls /usr/lib/jvm/java-6-openjdk/jre/bin/../lib/i386/jli/

However Java does work under root:

$ sudo java -version
java version "1.6.0_18"
OpenJDK Runtime Environment (IcedTea6 1.8.7) (6b18-1.8.7-2~lenny1)
OpenJDK Client VM (build 14.0-b16, mixed mode, sharing)

How can I launch Java as a regular user without errors?

share|improve this question
here's an attempt at an answer – Tshepang Jul 14 '11 at 9:20
For Linux-related questions, you will normally get a better/faster response from U&L. Just my experience. – Tshepang Jul 14 '11 at 9:24
I regularly had problems with the OpenJDK version of Java... Maybe you should try with the non-free Java? Do a aptitude search sun-java6 (you need to have the non-free repositories enabled in your sources.list). – nodiscc Jul 14 '11 at 12:18
Could you give details on your linux distribution & method of installing java? This looks like it could be a PATH issue. I'm guessing you also need to run through update-alternatives. – PriceChild Jul 14 '11 at 13:47
I'm tried update-alternatives. I't does not give effect. – aetaur Jul 14 '11 at 16:15

Pay attention how the links are configured. I found a server where a mistake had happen and /etc/bin/java was replaced with a binary. That made the library not found error to appear. I relinked /usr/bin/java to /etc/alternatives/java, and all works again.

# namei -mx /usr/bin/java
f: /usr/bin/java
 drwxr-xr-x /
 drwxr-xr-x usr
 drwxr-xr-x bin
 lrwxrwxrwx java -> /etc/alternatives/java
   drwxr-xr-x /
   drwxr-xr-x etc
   drwxr-xr-x alternatives
   lrwxrwxrwx java -> /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
     drwxr-xr-x /
     drwxr-xr-x usr
     drwxr-xr-x lib
     drwxr-xr-x jvm
     lrwxrwxrwx jre-1.6.0-openjdk.x86_64 -> java-1.6.0-openjdk-
       drwxr-xr-x java-1.6.0-openjdk-
       drwxr-xr-x jre
     drwxr-xr-x bin
     -rwxr-xr-x java

My hunch is that OpenJDK does some sort of path canonisation when it looks for libs.

share|improve this answer

Perhaps you've got a single instance from Ubuntu with no elevated privs, but it still can't find the lib as in this report.


ln -s /usr/lib/jvm /lib
share|improve this answer

That problem happened to me when you run java in a chroot-jail.

If you check with chrpath out from the chroot you will see something like this:

chrpath /opt/test/demo/opt/test/jdk/bin/java
/opt/test/demo/opt/test/jdk/bin/java: RPATH=$ORIGIN/../lib/amd64/jli:$ORIGIN/../jre/lib/amd64/jli

ELF for security not evaluate $ORIGIN witch isn't an environment var so you have to set some environment variable before run the java:

export JAVA_HOME=/opt/test/jdk
export LD_LIBRARY_PATH=$JAVA_HOME/lib/amd64/jli:$JAVA_HOME/jre/lib/amd64/jli


LD_ORIGIN_PATH=/opt/test/jdk/bin /opt/test/jdk/bin/java
share|improve this answer

I know this is a very old question, but I just ran in to the same problem and think the following link may help:

The problem may occur if you grant posix capabilities to the java executable. In that case, will refuse to link if run java as a non-root user. The detailed causes and solution can be found in the link above, but to be short, executing the following lines of command as root should solve the problem:

echo /opt/java/jdk1.7.0_71/lib/amd64/jli >> /etc/
rm /etc/
ldconfig -v|grep jli

Remember to replace /opt/java/jdk1.7.0_71 with your actual java home path, and use /lib/i386/jli if you're on 32-bit machine. If the last command returns something like ->

, you should be good to go. If the cache is not refreshed correctly, you may need to restart your machine in some cases.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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