查询并卸载系统原有jdk
- 查看系统的jdk版本
java -version
显示:
openjdk version "1.8.0_102"
OpenJDK Runtime Environment (build 1.8.0_102-b14)
OpenJDK 64-Bit Server VM (build 25.102-b14, mixed mode)
- 查询自带的openjdk
rpm -qa | grep -i java
显示:
java-1.7.0-openjdk-1.7.0.111-2.6.7.8.el7.x86_64
java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.111-2.6.7.8.el7.x86_64
- 卸载自带jdk
yum remove *openjdk*
使用yum安装jdk
- 查询yum云端所支持的jdk版本
yum search java|grep jdk
- 选择对应版本安装
yum install -y java-1.8.0-openjdk
- 检查是否安装成功
java -version