First, the installation environment
OS: Centos 7.4
JDK Version: 1.8
Tools: Xshell5, Xftp5
Second, the installation step
Step One: Download the installation package
( Official website ) link:
jdk version download their own systems, as: I downloaded the 64-bit .tar.gz package
Wget command may also be directly mounted directly JDK download package, particularly of Run please Mother.
The second step, extracting installation package
The JDK downloaded installation package uploaded to the server via xFTP, a customizable storage directory (/ home / temp) discharge and decompression, execute the command line as follows:
1 # mkdir /home/temp
2 # cd /home/temp 3 # tar -zxvf jdk-8u181-linux-x64.tar.gz
Moving [all data] jdk1.8.0_181 inside to the specified folder after decompression (e.g., / usr / local / java)
# mkdir /usr/local/java
[] In the next jdk1.8.0_181 data copied to the java directory
# mv /home/temp/jdk1.8.0_181 /usr/local/java
The third step, modify environment variables
Modify environment variables, the command
# vim /etc/profile
With vim editor to edit the profile file, add it to the end of the file (press "i" to enter the edit):
export JAVA_HOME=/usr/local/java export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin export PATH=$PATH:${JAVA_PATH}
Then, save and exit (press: wq!)
After saving finished, the command source / etc / profile file effective immediately let profile
The fourth step is to test whether the installation is successful
①, using the javac command, command not found error does not appear
②, using java -version, appeared version java version "1.8.0_181"
③, echo $ PATH, to see if he had just set the environment variable is configured correctly
No problem that is installed successfully test
Original link: https: //www.cnblogs.com/kingsonfu/p/9801556.html