1. View the Java version
[Email protected] ~]# java-version
Java Version "1.8.0_121"
Java (TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot (TM) 64-bit Server VM (build 25.121-b13, Mixed mode)
2. Upload the JDK file to the specified directory and unzip
Drwxr-xr-x 8 UUCP 143 4096 Dec jdk1.8.0_121
-rw-r--r--1 root root 183246769 Apr 18:38 jdk-8u121-linux-x64.tar.gz
3. Setting Environment variables
[Email protected] ~]# Vim/etc/profile
At the top of the add: "①jre path do not miss configuration ② $PATH to put to <export path>"
Export java_home=/root/jdk1.8.0_121
Export JRE_HOME=/ROOT/JDK1.8.0_121/JRE
Export classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export path= $JAVA _home/bin: $PATH
4. Execute profile
[Email protected] ~]# Source/etc/profile
"This allows the configuration to take effect immediately without rebooting"
5. Tomcat has its own JDK configuration
/opt/tomcat_invest/bin/setclasspath.sh
Linux Server Configuration JDK