Install Java on CentOS/Redhat/Fedora

Make a work directory:

mkdir /root/work

Download and install Java RPM. Go to Java Download Center and download Java SE Development Kit (RPM) and place it in /root/work.

Once the download is done set permissions for RPM and run the executable:

chmod a+x jdk-6u14-linux-i586-rpm.bin

Configure and test the install. Once Java is installed, set default Java location. Firstly remove the symlink and create the new one to the new installed Java location:

rm /usr/bin/java
ln -s /usr/java/jdk1.6.0_14/bin/java /usr/bin/java

Now, check on the Java version:

java -version

You should get the output like this:

java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)