1.#rpm -qa | grep java <<检查系统是否已安装jdk
[root@localhost /]# java -version
java version "1.7.0_99"
OpenJDK Runtime Environment (rhel-2.6.5.1.el6-x86_64 u99-b00)
OpenJDK 64-Bit Server VM (build 24.95-b01, mixed mode)
[root@localhost /]# rpm -qa | grep java
tzdata-java-2016c-1.el6.noarch
java-1.7.0-openjdk-1.7.0.99-2.6.5.1.el6.x86_64
java-1.6.0-openjdk-1.6.0.38-1.13.10.4.el6.x86_64
2.# rpm -qa | grep java | xargs rpm -e --nodeps <<卸载openjdk
3.下载jdk-7u80-linux-x64.tar.gz上传至 usr/local/java目录(目录自建)。
4.#tar -zvxf jdk-7u80-linux-x64.tar.gz <<解压后
5.#rm -rf jdk-7u80-linux-x64.tar.gz <<删除jdk-7u80-linux-x64.tar.gz文件
6.# vi /etc/profile <<配置全局java环境变量
进入编辑模式,最后面添加
export JAVA_HOME=/usr/local/java/jdk1.7.0_80
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=./:$JAVA_HOME/lib:$JAVA_HOME/jre/lib
7.#source /etc/profile <<配置文件生效