Check if java has been installed
java -version #View java version
Query the installed jdk
yum list installed | grep java
yum list installed | grep jdk
Uninstall the installed jdk package
yum remove java-1.8.0-openjdk*
View the openjdk included in the yum source
yum search openjdk
yum list | grep openjdk
yum list *openjdk*
View CentOS system version
cat /etc/system-release
cat /etc/centos-release
cat /etc/redhat-release
**1. First install reference **http://openjdk.java.net/install/
JRE | java-1.8.0-openjdk |
---|---|
JDK | java-1.8.0-openjdk-devel |
**2. Install JDK package java-1.8.0-openjdk-devel **
yum install java-1.8.0-openjdk-devel.x86_64
3. Configure global environment variables
vim /etc/profile
Add at the end of the profile file
JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.242.b08-0.el7_7.x86_64
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
source /etc/profile #Variable takes effect immediately
4. Verification is successful
java -version
Recommended Posts