系统版本:CentOS Linux release 7.2.1511 (Core),jdk版本:1.8.0_191
1、卸载openjdk
1.1查看安装的openjdk
rpm -qa | grep java
1.2卸载组件
语法:
rpm -e --nodeps [组件名称]
rpm -e --nodeps python-javapackages-3.4.1-11.el7.noarch
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
rpm -e --nodeps javapackages-tools-3.4.1-11.el7.noarch
rpm -e --nodeps java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
rpm -e --nodeps tzdata-java-2015g-1.el7.noarch
rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
2、安装jdk
tar -zxvf jdk-8u191-linux-x64.tar.gz -C /opt/module/
3、配置环境变量
vim /etc/profile
#JAVA_HOME
export JAVA_HOME=/opt/module/jdk1.8.0_191
export PATH=$PATH:$JAVA_HOME/bin
4、刷新配置
source /etc/profile
5、查看jdk版本
java -version
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)