Use yum command to install jdk under centos7

1. Check whether the system has installed java

$yum list installed | grep java

2. If you have an old version of java, you can uninstall java using the following method

$yum -y remove java-1.8.0-openjdk*

Three, view the java package list

$yum -y list java*

Fourth, download and install all the software packages of java1.8, you need to enter y to confirm the download in the middle.

$yum install java-1.8.0-openjdk*

5. The installation is successful. Enter the following command to check whether the installation is successful. If the correct version number is returned, the installation is successful.

$java -version
displays as follows to indicate a successful installation:
[root@VM_0_17_centos /]# 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)

Guess you like

Origin blog.csdn.net/qq_38428298/article/details/108484661