Very busy right now, so here’s a quick and dirty writeup for install Java 1.6 on centos5.
To install the JDK
yum install -y jpackage-utils
wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64-rpm.bin?BundledLineItemUUID=KxWJ_hCuwSUAAAEvTWRZB8TT&OrderID=WeuJ_hCuedUAAAEvLGRZB8TT&ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&FileName=/jdk-6u14-linux-x64-rpm.bin
chmod +x jdk-6u14-linux-i586-rpm.bin
./jdk-6u14-linux-i586-rpm.bin
To install the JRE
If you dont have a build environment yet, create one (non-root user!) For example:
yum install -y rpm-build gcc gcc-c++ redhat-rpm-config
useradd builder
su - builder
vi ~/.rpmmacros
add the following:
%_topdir /home/
%_tmppath %{_topdir}/tmp
mkdir -p ~/rpmbuild/{SOURCES,SRPMS,SPECS,RPMS,tmp,BUILD}
cd ~/rpmbuild/SOURCES
Download Sun JDK 1.6 update 14 jdk-6u14-linux-i586.bin or jdk-6u14-linux-x64.bin
wget http://cds.sun.com/is-bin/INTERSHOP.enfinity/WFS/CDS-CDS_Developer-Site/en_US/-/USD/VerifyItem-Start/jdk-6u14-linux-x64.bin?BundledLineItemUUID=cDCJ_hCudtMAAAEvQWRZB8TT&OrderID=WeuJ_hCuedUAAAEvLGRZB8TT&ProductID=tPxIBe.oz2IAAAEhmh0zLjfT&FileName=/jdk-6u14-linux-x64.bin
cd ~/rpmbuild/
Download the nosrc.rpm from jpackage
wget wget http://mirrors.dotsrc.org/jpackage/6.0/generic/SRPMS.non-free/java-1.6.0-sun-1.6.0.14-1jpp.nosrc.rpm
Rebuild the packages:
rpmbuild --rebuild java-1.6.0-sun-1.6.0.14-1jpp.nosrc.rpm
exit to root user
yum install jpackage-utils
Make sure you install the java and devel package, otherwise alternatives wont configure 1.6 properly
yum --nogpgcheck localinstall java-1.6.0-sun-1.6.0.14-1jpp.x86_64.rpm java-1.6.0-sun-devel-1.6.0.14-1jpp.x86_64.rpm
Select the new version of java to use:
alternatives --config java
Confirm that the correct version of java is running:
java --version
If its wrong, check the symlink for /usr/bin/java
Also check the $JAVA_HOME variable
Restart tomcat or whatever is using Java, to make sure its using the new JVM.