- Download JDK7 from
http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.htmlSelect "Linux x86 - Compressed Binary" jdk-7-linux-i586.tar.gz

- 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 javaFor 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 1Note: 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
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".