1.查看系統安裝的jdk版本
# java -version
# rpm -qa | grep jdk
# yum remove -y java-1.7.0-openjdk-1.7.0.99-2.6.5.0.el6_7.x86_64
# yum remove -y java-1.6.0-openjdk-1.6.0.0-11.1.13.4.el6.x86_64
2.刪除原jdk1.8
# cd /usr/local/
# rm -rf jdk
# rm -rf jdk1.8.0_73
3.進入到目錄下並上傳
# cd /server/tools/
# rz -y
jdk-7u79-linux-x64.gz
4.安裝jdk1.7
# tar xf jdk-7u79-linux-x64.gz -C /usr/local/
# ln -s /usr/local/jdk1.7.0_79/ /usr/local/jdk
# chown -R root.root /usr/local/jdk
5.配置java的環境變量
# vim /etc/profile
末尾添加
export JAVA_HOME=/usr/local/jdk
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH
export CLASSPATH=.$CLASSPATH:$JAVA_HOME/lib:$JAVA_HOME/jre/lib:$JAVA_HOME/lib/tools.jar
配置生效
# source /etc/profile
6.查看jdk版本信息
# java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)
http://xxxxxx/Linuxjc/1134301.html TechArticle