centos7 卸载openJdk,并安装JDK1.8

/ 技术分享 / 没有评论 / 2318浏览

centos7 卸载openJdk,并安装JDK1.8

  1. 查看jdk版本
[root@localhost ~]# java -version
openjdk version "1.8.0_131"
OpenJDK Runtime Environment (build 1.8.0_131-b12)
OpenJDK 64-Bit Server VM (build 25.131-b12, mixed mode)
  1. 查询安装的包
[root@localhost ~]# rpm -qa|grep jdk
java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64
copy-jdk-configs-2.2-3.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64
java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64
  1. 删除openJDK版本
[root@localhost ~]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.141-2.6.10.5.el7.x86_64 java-1.8.0-openjdk-headless-1.8.0.131-11.b12.el7.x86_64 java-1.8.0-openjdk-1.8.0.131-11.b12.el7.x86_64 java-1.7.0-openjdk-headless-1.7.0.141-2.6.10.5.el7.x86_64
  1. 下载JDK1.8安装包并安装

[root@localhost 下载]# rpm -ivh jdk-8u162-linux-x64.rpm 
准备中...                          ################################# [100%]
正在升级/安装...
   1:jdk1.8-2000:1.8.0_162-fcs        ################################# [100%]
Unpacking JAR files...
	tools.jar...
	plugin.jar...
	javaws.jar...
	deploy.jar...
	rt.jar...
	jsse.jar...
	charsets.jar...
	localedata.jar...
  1. 查看安装后的JDK版本
[root@localhost ~]# java -version
java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)