CentOS6.4 java environment
1.Download jdk rpm package:jdk-7u40-linux-i586.rpm
2.sudo rpm -ivh jdk-7u40-linux-i586.rpm
3.update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_40/bin/java 300
update-alternatives --remove java /usr/java/jdk1.7.0/bin/java
4.alternatives --config java
5.vi /etc/profile
#java environment
export JAVA_HOME=/usr/java/jdk1.7.0_40
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
6.source /etc/profile