Using yum to install openjdk, simple and fast.

yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel

java -version

nano /etc/profile

#Add the following lines at the bottom:
JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64
PATH=$PATH:$JAVA_HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH JAVA_HOME CLASSPATH

Add the below after install Tomcat6.

TOMCAT_HOME=/usr/share/tomcat6
export PATH JAVA_HOME CLASSPATH TOMCAT_HOME

 

To install Oracle JRE refer to http://wiki.centos.org/HowTos/JavaOnCentOS

 

Install Tomcat:

cd /etc/yum.repos.d
wget 'http://www.jpackage.org/jpackage50.repo'
yum update
yum install tomcat6 tomcat6-webapps tomcat6-admin-webapps
service tomcat6 start


if encoutner dependency error, try:

rpm -i http://candrews.integralblue.com/wp-content/uploads/2009/07/jpackage-utils-compat-el5-0.0.1-1.noarch.rpm

then install again.