1.1 Decompress jdk
Create a java folder where users store Java files
mkdir /usr/local/java
Upload the downloaded jdk installation package to the java folder through the ftp tool.
Unzip:
cd /usr/local/java
tar -vxzf jdk-8u181-linux-x64.tar.gz
After the decompression is successful, you will see in the current directory:
jdk1.8.0_181
folder
Then delete the installation package:
rm jdk-8u181-linux-x64.tar.gz
1.2 Configure jdk
Set environment variables:
vim /etc/profile
Add at the end:
JAVA_HOME=/usr/local/java/jdk1.8.0_181
PATH=$PATH:$HOME/bin:$JAVA_HOME/bin
export JAVA_HOME
export PATH
Reload the configuration file for environment variables:
source /etc/profile
Detection:
java -version
{{o.name}}
{{m.name}}