-
After logging in to Linux, switch directories to /usr/local
Cd/user/local
-
new Folder in /usr/local directory java to store jdk files
mkdir Java
-
in folder Java download jdk file ( jdk network path can be replaced according to your own needs)
First switch directory to Java
cd java
download online JDK
wget--no-check-certificate--no-cookies--header "cookie:oraclelicense= Accept-securebackup-cookie "http://download.oracle.com /otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.tar.gz
-
Unzip the JDK to the current directory
Tar jdk-8u181-linux-x64.tar.gz
Delete the package after decompression is complete
RM jdk-8u181-linux-x64.tar.gz
-
To edit a configuration file, configure environment variables
Vim/etc/profile
Add to:
Export java_home=/usr/local/jdk1.7.0_71
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $JAVA _home/bin: $PATH
Press ESC, enter : Wq, save and exit
-
Reload the system configuration file
Source/etc/profile
-
check that the JDK is installed successfully
java-version
back to JDK version
Javac The JDK was installed successfully
"Linux" JDK installation and environment variable configuration