Installing Java 1.6 on CentOS 6
Java 1.5 is the default Java version you get when you ask yum to install it on CentOS. However, several applications need 1.6 in order to run. Just follow the next steps to install it.
Remove Java 1.5
yum remove java-1.5-*
Install the rpmforge repository
cd
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
Check if you have a 32 or 64 CentOS version
uname -a
For 32 versions (i686) download and install the following repository
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm
rpm -Uhv rpmforge-release-0.5.3-1.el6.rf.i686.rpm
For 64 version (x64) download and install the following repository
wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
rpm -Uhv rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Install Java 1.6
yum -y install java-1.6.0-openjdk
If the rpmforge repository is not enabled (it should be, but just in case) try the following command instead
yum -y --enablerepo=rpmforge install java-1.6.0-openjdk
Check your Java version
java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.7.9) (rhel-1.36.b17.el6_0-x86_64)
OpenJDK 64-Bit Server VM (build 14.0-b16, mixed mode)
Done!