1) Download jdk1.6.0_04 x64 version for Linux from http://java.sun.com
2) Add executable permission to the current user.
>chmod u+x jdk-6u4-linux-amd64.bin
3) Install the software
The JDK will be installed in the current working directory as jdk1.6.0_04. Therefore, if we want to install in /opt directory, switch to root and move the whole jdk1.6.0_04 directory to /opt
4) Set jdk as a default java.
>update-alternatives –install /usr/bin/java java /opt/jdk1.6.0_04/bin/java 300
>update-alternatives –config java
This setting will work for both root and normal user.
5) Add jdk java path to environment. This setting will work for normal user if we add java path to .bashrc in the normal user home.
– Create a new file called “.mysetup” in the home directory
– Add the following lines to the “.mysetup” file
– Save “.mysetup” file, and open “.bashrc” file in the home directory
– Add the following line at the end of “.bashrc” file
– Save the “.bashrc” file and activate changes