Tuesday, October 18, 2011

Install Java 1.7.0 on ubuntu 11.10

- Download JDK7 from http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html

Select "Linux x86 - Compressed Binary" jdk-7-linux-i586.tar.gz

Download JDK7

- Start Terminal, switch to the downloaded folder, and uncompress it.
$ tar -xvf jdk-7-linux-i586.tar.gz

- Move the un-compressed files to /usr/lib
$ sudo mv ./jdk1.7.0 /usr/lib/jvm/jdk1.7.0

- Check the current alternative java installed.
$ sudo update-alternatives --config java

For a flash Ubuntu 11.10, it's only ONE java installed.

- Install the new alternative java
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0/jre/bin/java 1

Note: The last parameter is "priority", it is an integer; options with higher numbers have higher priority in automatic mode.

- Re-check the current alternative java installed and select the active java.
$ sudo update-alternatives --config java

- Finally check the java version.
$ java -version

Install Java 1.7.0 on ubuntu 11.10

It's steps to install JRE 1.7.0, not JDK. If you are looking for install JDK7 (Javac), please refer to the article "Install JDK7 (javac) on ubuntu 11.10".