Install jdk1.8 in Linux(CentOS7).
Check whether the JDK comes with you
rpm -qa|grep java
Copy the code
If there is use the following command to delete, XXX yyy ZZZ represents the query out of the JDK name, name separated by a space in the middle, so far has not encountered the own.
rpm -e --nodeps xxx yyy zzz
Copy the code
Second, download JDK upload
If you want to use jdK8, you can download the JDK from jdK8’s official website. If you want to use jdK8’s official website, you can download JDK from JDK8’s official website. Upload the file to the /usr/local/src directory in Linux.
Install the JDK
1. Create a directory and decompress the directory to the specified directory
mkdir -p /usr/local/java
tar -zxvf jdk-8u202-linux-x64.tar.gz -C /usr/local/java/
Copy the code
2. Configure environment variables
After the decompression is complete, edit the configuration file and configure environment variables.
vim /etc/profile
Copy the code
At the bottom of the file add:
Export JAVA_HOME=/usr/local/ Java /jdk1.8.0_202 export JRE_HOME=$JAVA_HOME/jre export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH export CLASSPATH=$CLASSPATH:.:$JAVA_HOME/lib:$JRE_HOME/libCopy the code
Save the configuration and exit to refresh the configuration.
source /etc/profile
Copy the code
3. Verify whether the JDK configuration is successful
java -version
Copy the code
If the following JDK version information is displayed, the configuration succeeds.
Java version "1.8.0_202" Java(TM) SE Runtime Environment (Build 1.8.0_202-B08) Java HotSpot(TM) 64-bit Server VM (build 25.202 - b08, mixed mode)Copy the code
Now that you’ve read this, please like, comment, follow and bookmark it!
Author: IT wang2 xiao3 er4 starting address: www.itwxe.com/posts/c74ad… Copyright notice: The content of this article is licensed by authorship – non-commercial use – No Interpretation 4.0 international.