删除 Centos7 中附带的 OpenJDK 1.8

Scroll Down

1.先检测java版本

使用java -version命令:

# java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)	

2.查询现有已安装的openjdk模块

使用rpm -qa | grep java命令:

# rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2020a-1.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.252.b09-2.el7_8.x86_64
java-1.8.0-openjdk-1.8.0.252.b09-2.el7_8.x86_64

3.删除对应模块

yum -y remove python-javapackages
yum -y remove tzdata-java

4.删除后验证

rpm -qa | grep java

没有返回,即删除成功~