卸载jdk
[[email protected] ~]# rpm -qa|grep jdk //查询已安装的jdk
java-1.7.0-openjdk-1.7.0.79-2.5.5.3.el6_6.x86_64
[[email protected] ~]# #rpm -e --nodeps ava-1.7.0-openjdk-1.7.0.79-2.5.5.3.el6_6.x86_64 //卸载已安装的jdk
[[email protected] soft]# chmod u+x jdk-6u45-linux-x64.bin //给jdk安装文件执行权限
[[email protected] soft]# ./jdk-6u45-linux-x64.bin //安装jdk
[[email protected] jdk1.6.0_45]# vi /etc/profile //配置jdk环境变量
export JAVA_HOME=/opt/soft/jdk1.6.0_45
export CLASSPATH=$JAVA_HOME/lib
export PATH=$JAVA_HOME/bin:$PATH
[[email protected] jdk1.6.0_45]# source /etc/profile //使配置文件立即生效
[[email protected] jdk1.6.0_45]# java -version //测试成功
java version "1.6.0_45"
Java(TM) SE Runtime Environment (build 1.6.0_45-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode)