1、查看是否已安装JDK,卸载
yum list installed |grep java
java-1.8.0-openjdk.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-accessibility.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-accessibility-debug.x86_64 java-1.8.0-openjdk-debug.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-demo.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-demo-debug.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-devel.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-devel-debug.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-headless.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-headless-debug.x86_64 java-1.8.0-openjdk-javadoc.noarch 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-javadoc-debug.noarch 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-javadoc-zip.noarch 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-javadoc-zip-debug.noarch java-1.8.0-openjdk-src.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-1.8.0-openjdk-src-debug.x86_64 1:1.8.0.181-3.b13.el7_5 @updates java-atk-wrapper.x86_64 0.30.4-5.el7 @base javapackages-tools.noarch 3.4.1-11.el7 @base python-javapackages.noarch 3.4.1-11.el7 @base tzdata-java.noarch 2018e-3.el7 @updates
2、卸载Java环境
yum -y remove java-1.8.0-openjdk* ---表时卸载所有openjdk相关文件输入
yum -y remove tzdata-java.noarch ----卸载tzdata-java
3、安装JDK
yum -y list java* ---查看JDK安装包列表
yum -y install java-1.8.0-openjdk* ---安装1.8.0