How to install java 1.6.22 JRE on ubuntu

$ cd /opt
$ sudo mkdir java
$ cd java
$ sudo mkdir 32
$ sudo mv ~/Desktop/jre-6u22-linux-i586.bin /opt/java/32
$ sudo chmod 755 /opt/java/32/jre-6u22-linux-i586.bin
$ cd /opt/java/32
$ sudo ./jre-6u22-linux-i586.bin

Agree the license agreement

$ sudo update-alternatives --install "/usr/bin/java" "java" "/opt/java/32/jre1.6.0_22/bin/java" 1
$ sudo update-alternatives --set java /opt/java/32/jre1.6.0_22/bin/java

Install the Firefox plugin

$ mkdir ~/.mozilla/plugins
$ sudo apt-get remove icedtea6-plugin
$ rm ~/.mozilla/plugins/libjavaplugin_oji.so
$ rm ~/.mozilla/plugins/libnpjp2.so
$ ln -s /opt/java/32/jre1.6.0_22/lib/i386/libnpjp2.so ~/.mozilla/plugins/