1、jdk下载
https://www.oracle.com/technetwork/java/javase/downloads/jdk11-downloads-5066655.html
2、安装
rpm –ivh jdk-11.0.1_linux-x64_bin.rpm
3、设置环境变量
vim /etc/profile
在配置文件末尾添加全局变量
JAVA_HOME=/usr/java/jdk-11.0.1 (jdk的安装路径)
PATH=$JAVA_HOME/bin:$PATH:$HOME/bin
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH JAVA_HOME CLASSPATH CATALINA_HOME
4、生效环境比变量
source /etc/profile
5、测试是否生效
java -version
java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)