Search code examples
javaandroid-sourcejava-6

jar: error while loading shared libraries: libjli.so [How to manually install Java 6]


I'm running into this error when I'm building android 2.3 from source code on Ubuntu 10.04. I am suspecting it is an issue with a path or something along those lines but cannot figure it out. I have seen similar people have this issue but I haven't found any solution that works for me. I included some information about my environment, any help would be appreciated(if you know my path's are correct then even that would be beneficial as I could start look into other possible sources of error). Thanks.

java -version should indicate the installation was successful:

juan@juan-desktop:~/bin/WORKING_DIRECTORY$ java -version
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)

My .bashrc has:

export JAVA_HOME=/usr/java/jdk1.6.0_45/bin/java

PATH=$PATH:/usr/local/bin:/usr/bin:/usr/lib:/usr/lib/jvm:/usr/lib/jvm/jdk1.6.0_45/bin

Some more info:

juan@juan-desktop:~$ 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/jdk1.6.0_45/bin/java
     Drwxr-xr-x /
     drwxr-xr-x usr
     drwxr-xr-x lib
     drwxr-xr-x jvm
     drwxr-xr-x jdk1.6.0_45
     drwxr-xr-x bin
     -rwxr-xr-x java

Solution

  • I'm posting my solution on here in case anyone else runs into a similar problem and stumbles across this. I simply re-installed my OS, ran the steps again, and everything worked perfectly fine this time. I must have caused some sort of error on my machine as I ran the same exact steps too. Here is what I did to manually install Java 6 on a clean machine:

    1. Install Java 6(.bin format) from the Oracle website
    2. Give it executable permissons and execute it
    3. Add a jvm folder to usr/lib/
    4. Move your Java 6 folder to usr/lib/jvm
    5. Link java/javaws/javac to usr/bin using the ln -s command
    6. Add your Java6 and Java/bin location to your path. For me its:

      export JAVA_HOME=usr/lib/jvm/jdk1.6.0_45

      export PATH=/usr/bin:$JAVA_HOME/bin