Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to launch Java:

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

$ ldd /usr/lib/jvm/java-6-openjdk/jre/bin/java
        linux-gate.so.1 =>  (0xb779f000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb7780000)
        libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb7767000)
        libjli.so => /usr/lib/jvm/java-6-openjdk/jre/bin/../lib/i386/jli/libjli.so (0xb7762000)
        libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb775e000)
        libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb7603000)
        /lib/ld-linux.so.2 (0xb77a0000
$ ls /usr/lib/jvm/java-6-openjdk/jre/bin/../lib/i386/jli/
libjli.so

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
show 1 more comment

2 Answers

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-1.6.0.0.x86_64/jre
       drwxr-xr-x java-1.6.0-openjdk-1.6.0.0.x86_64
       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
add comment

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.

Try

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

Your Answer

 
discard

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.