1.先解压JDK(这样可以减少切换JDK造成的时间)
cp jdk-7u75-linux-x64.tar.gz /usr/local/iron/java 1. tar xvf jdk-7u75-linux-x64.tar.gz
2.配置环境变量
[root@localhost~]# vi /etc/profile export JAVA_HOME=/usr/local/iron/java/jdk1.7.0_79 export JRE_HOME=/usr/local/iron/java/jdk1.7.0_79/jre export PATH=$PATH:/usr/local/iron/java/jdk1.7.0_79/bin export CLASSPATH=./:/usr/local/iron/java/jdk1.7.0_79/lib:/usr/local/iron/java/jdk1.7.0_79/jre/lib
3.卸载原来的 OpenJDK
[root@tzrmyyhospital10 ~]# rpm -qa|grep java java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64 java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64 tzdata-java-2013g-1.el6.noarch [root@tzrmyyhospital10 ~]# [root@tzrmyyhospital10 ~]# rpm -e --nodeps tzdata-java-2013g-1.el6.noarch [root@tzrmyyhospital10 ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64 [root@tzrmyyhospital10 ~]# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
4.让环境变量生效
source /etc/profile