卸载
CentOS会自带OpenJDK,卸载自带的OpenJDK,再安装我们需要的版本
1 2 3 4 5 6 7 8 9
| $ rpm -qa | grep jdk
java-11-openjdk-headless-11.0.4.11-1.el7_7.x86_64 java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64 copy-jdk-configs-3.3-10.el7_5.noarch
$ rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64 $ rpm -e --nodeps java-11-openjdk-headless-11.0.4.11-1.el7_7.x86_64 $ rpm -e --nodeps copy-jdk-configs-3.3-10.el7_5.noarch
|
搜索
1
| $ yum search openjdk | grep -i --color openjdk
|
安装
1 2 3 4 5 6 7 8 9
| $ yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
$ yum install java-11-openjdk java-11-openjdk-devel
$ java -version openjdk version "11.0.4" 2019-07-16 LTS OpenJDK Runtime Environment 18.9 (build 11.0.4+11-LTS) OpenJDK 64-Bit Server VM 18.9 (build 11.0.4+11-LTS, mixed mode, sharing)
|