JDK Linux X64 下载: jdk-8u421-linux-x64.tar.gz

创建路径 /usr/local/java

解压 JDK 压缩包 tar zxvf jdk-8u421-linux-x64.tar.gz

移动内容 mv jdk1.8.0_421 /usr/local/java

最终路径为 /usr/local/java/jdk1.8.0_421

配置 /etc/profile

export JAVA_HOME=/usr/local/java/jdk1.8.0_421
export CLASSPATH=$:LCASSPATH:$JAVA_HOME/lib/
export PATH=$PATH:$JAVA_HOME/bin

重新载入配置文件 source /etc/profile

检测是否安装成功

$ java -version
java version "1.8.0_421"
Java(TM) SE Runtime Environment (build 1.8.0_421-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.421-b09, mixed mode)