This is the English version of this article of mine.
- This is my crowded JVM directory:
$ ls -lh /usr/lib/jvm/
total 12K
lrwxrwxrwx 1 root root 21 2012-05-27 20:19 java -> /usr/lib/jvm/jdk1.7.0_15
drwxr-xr-x 4 root root 4,0K 2012-07-16 21:19 java-1.5.0-gcj-4.4
drwxr-xr-x 8 root root 4,0K 2012-07-26 11:17 java-7-oracle
drwxr-xr-x 8 500 143 4,0K 2013-02-15 18:21 jdk1.7.0_15
- I do not want a messy system. So I wiped it all up.
$ sudo rm /usr/lib/jvm/j*
- Download Java JDK from Oracle. Today, this is the correct link for it. Choose the .tar.gz version. I downloaded both architecture versions:
- jdk-7u15-linux-i586.tar.gz
- jdk-7u15-linux-x64.tar.gz
- Unpack the tar file to the correct directory, which is /usr/lib/jvm/. If this does not exist, create it.
$ sudo tar xf jdk-7u15-linux-x64.tar.gz -C /usr/lib/jvm/
- Make each binary of ths new version of Java visible to Alternatives system:
$ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_15/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_15/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/lib/jvm/jdk1.7.0_15/bin/javaws" 1
This is for 32bits systems:
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_15/jre/lib/i386/libnpjp2.so" 1
This is for 64bits systems:
$ sudo update-alternatives --install "/usr/lib/mozilla/plugins/libjavaplugin.so" "mozilla-javaplugin.so" "/usr/lib/jvm/jdk1.7.0_15/jre/lib/amd64/libnpjp2.so" 1 - Choose each one of the binaries correctly:
$ sudo update-alternatives --config java
$ sudo update-alternatives --config javac
$ sudo update-alternatives --config mozilla-javaplugin.so
$ sudo update-alternatives --config javaws
This last step will list the versions available, if any. Choose the one from /usr/lib/jvm/jdk1.7.0_15, for this example.
After that, you just need to test the version. Do this for each one of the binaries:
$ java -version
$ javac -version
This article was built upon Ubuntu Documentation.
No comments:
Post a Comment