缺省java版本为OpenJDK 1.7:
# java -version
java version "1.7.0_09-icedtea"
OpenJDK Runtime Environment (rhel-2.3.4.1.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 23.2-b09, mixed mode)
# update-alternatives --config java
There are 2 programs which provide 'java'.
-----------------------------------------------
*+ 1
安装Oracle JDK 1.7: # rpm -ivh /mnt/hgfs/pub/jdk-7u45-linux-x64.rpm
update-alternatives添加Oracle JDK 1.7: # update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_45/bin/java 1
更改缺省JDK版本: # update-alternatives --config java
There are 3 programs which provide 'java'.
-----------------------------------------------
*+ 1
Enter to keep the current selection[+], or type selection number: 3
# java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
转载: http://blog.sina.com.cn/s/blog_71d9aee40101qg03.html