Hi, this is my first post to this blog, I just installed Ubuntu 14.04 LTS. And it has been a great experience. But I will dig more about my install experiences at another time.
Ok let's see how to install Oracle JDK 1.6. Beware that this is Oracle JDK and not Open JDK.
First download jdk1.6 here.
You will get a file like this one: jdk-6u45-linux-x64.bin. Then open a terminal and go to you downloads directory.
1. Give execution privilege to the file:
$ chmod a+x jdk-6u45-linux-x64.bin
2. Run file to extract contents.
$ ./jdk-6u45-linux-x64.bin
3. Move jdk to /usr/lib/jvm
$ sudo mv jdk1.6.0_45 /usr/lib/jvm
4. Create Symbolik Link
$ sudo ln -s /usr/lib/jvm/jdk1.6.0_45/ /usr/lib/jvm/jdk1.6
5. Change group and owner.
$ sudo chown root:root -R /usr/lib/jvm/jdk1.6.0_45/
6. Add variables to global profile, first edit your profile with your favorite editor
$ sudo vi /etc/profile
Add this at the end:
export JAVA_HOME=/usr/lib/jvm/jdk1.6
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
7. (Optional) Create Symbolic Links
$ sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6/bin/java 100
$ sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6/bin/javac 100
$ sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6/bin/javaws 100
And that's it. You can test your installation with the following commands.
$ java -version
$ javac -version
$ javaws -viewer
Update 2015-07-04
Today I followed this guide using JDK 1.5 (jdk-1_5_0_22-linux-amd64.bin) and everything was fine.
Update 2015-07-31
Today I followed this guide using JDK 1.8 (jdk-8u45-linux-x64.tar.gz) and everything was fine. The only difference insetead of running a .bin file you need to run:
$ tar -xvzf jdk-8u45-linux-x64.tar.gz