使用yum安装OpenJDK

搜索yum包含的JDK

[root@localhost ~]# yum search java|grep jdk
java-1.8.0-openjdk.i686 : OpenJDK Runtime Environment 8
java-1.8.0-openjdk.x86_64 : OpenJDK Runtime Environment 8
java-11-openjdk.i686 : OpenJDK Runtime Environment 11
java-11-openjdk.x86_64 : OpenJDK Runtime Environment 11

安装JDK1.8

[root@localhost ~]# yum install -y java-1.8.0-openjdk

yum参数-y指的是不用确认直接下载安装

确认是否安装成功

[root@localhost ~]# java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)

文章来源于互联网,如有雷同请联系站长删除:centos安装JDK

发表评论