First, check the version of the local centos
[root@localhost lib]# cat /etc/redhat-release CentOS Linux release 8.1.1911 (Core)
Description: architecture forests is a focus on architecture blog, address: https://www.cnblogs.com/architectforest
The corresponding source code can be accessed here for: https://github.com/liuhongdi/
Description: Author: Liu association E-mail: [email protected]
Second, download jdk
Official website address
https://www.oracle.com/java/
Select this version:
jdk-13.0.2_linux-x64_bin.tar.gz
Third, the installation
[root@localhost source]# tar -zxvf jdk-13.0.2_linux-x64_bin.tar.gz [root@localhost source]# mv jdk-13.0.2 /usr/local/soft/
Fourth, configure the environment variables
Edit / etc / profile
[root@localhost source]# vi /etc/profile
Add the following:
export JAVA_HOME=/usr/local/soft/jdk-13.0.2 export JRE_HOME=${JAVA_HOME}/jre export CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
Validate the configuration:
[root@localhost source]# source /etc/profile
Fifth, to view java version of the test installation was successful
[root@localhost source]# java --version java 13.0.2 2020-01-14 Java(TM) SE Runtime Environment (build 13.0.2+8) Java HotSpot(TM) 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)