First, download jdk (linux version)
In Oracle's official website yesterday I got good times, do not know what the problem have failed, everyone found a website: Huawei mirror sites
I gave everyone here a share of Baidu network disk resources: jdk1.8 (Linux) ////// extraction code: osws
Second, create a directory to store the jdk
sudo mkdir /usr/local/jdk
Third, find the directory of your local installation of jdk, jdk unzip the downloaded to the directory we created
sudo tar -zxvf (你本地的 jdk 的路径) -C /usr/local/jdk
Fourth, configure the environment variables
1. Open the configuration file
sudo vi /etc/profile
2. modify the configuration, the end of the file, add the following code, save and exit
export JAVA_HOME=/usr/local/jdk1.8.0_171 #这里 ( jdk1.8.0_171 ) 是你本地 jdk 文件的名字
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tool.jar
3. Enter the command, the configuration file to take effect
source /etc/profile
V. verification
java
java -version