Home > Article > Operation and Maintenance > How to install jdk in CentOS7
How to install jdk in CentOS7
1. Before installation, check whether the system comes with open-jdk
Command:
rpm -qa |grep java rpm -qa |grep jdk rpm -qa |grep gcj
If no information is entered, it means there is no installation. If installed, you can use rpm -qa | grep java | xargs rpm -e --nodeps to batch uninstall all files with Java. The keyword of this command is java.
Recommended learning: thinkphp tutorial
2. Then retrieve the list containing java
yum list java*
3. Select the jdk version you need to install. For example, to install 1.8 here, execute the following command:
yum install -y java-1.8.0-openjdk-devel.x86_64
Wait until the installation is completed.
4. After the installation is complete, check the installed jdk version and enter the following command:
java -version
Here you can see the jdk version information you installed. .
The jdk installed in this way will be installed under the usr/lib/jvm directory
This article comes from PHP Chinese Net, CentOS usage tutorial column, please pay attention to this column for more related tutorials!
The above is the detailed content of How to install jdk in CentOS7. For more information, please follow other related articles on the PHP Chinese website!