1.Install JDK

If there is a JDK environment on the Linux server, this step can be ignored, and the installation of the second section of the link. If there is no JDK, first to the Oracle official website to download JDK, Download.

2.JAVA_HOME Configure

JDK extract can according to their actual situation to want to extract the path, here we extract to unzip /usr/java/jdk1.8 , as shown below:

cd /usr/java
tar -zxvf jdk-xxxx.tar.gz
mv jdk-xxxx jdk1.8
vi /etc/profile

export JAVA_HOME=/usr/java/jdk1.8
export PATH=$PATH:$JAVA_HOME/bin

Then, we use the . /etc/profile to enable the configuration to take effect immediately.

PS: If the authority is insufficient, please use the sudo command

Finally, we input java -version, according to the following information:

java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)
Copyright © smartloli 2018 all right reserved,powered by GitbookModify: 2018-02-09 03:05:49