Install Java 6 in Ubuntu

Java 6

Download jdk-6u45-linux-x64.bin from Oracle

$ chmod +x jdk-6u45-linux-x64.bin
$ ./jdk-6u45-linux-x64.bin
$ sudo mv jdk1.6.0_45 /opt
$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/jdk1.6.0_45/bin/java" 1
$ sudo update-alternatives --install "/usr/bin/javac" "javac" "/opt/jdk1.6.0_45/bin/javac" 1
$ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/opt/jdk1.6.0_45/bin/javaws" 1

$ sudo update-alternatives --set java /opt/jdk1.6.0_45/bin/java
$ sudo update-alternatives --set javac /opt/jdk1.6.0_45/bin/javac
$ sudo update-alternatives --set javaws /opt/jdk1.6.0_45/bin/javaws
($ sudo update-alternatives --config java)

Edit /etc/profile

JAVA_HOME=/opt/jdk1.6.0_45
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH