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)
Linux运维的自我修养-ywliyq
- 技术交流,请加QQ群:256172681
- 给我写信:[email protected]
- 我的技术博客:http://ywliyq.blog.51cto.com/