JDK 1.8 下载地址:jdk-8u111-linux-x64.tar.gz
1、解压jdk文件
tar -zxvf /home/dunhanson/upload/jdk-8u111-linux-x64.tar.gz -C /usr/local/
mv jdk1.8.0_111/ jdk
2、添加环境变量
vi /etc/profile
exportJAVA_HOME=/usr/local/jdk
export PATH=$PATH:$JAVA_HOME/bin
3、使环境变量立即生效
source /etc/profile
4、检查是否安装成功
java -version
java version "1.8.0_111" Java(TM) SE Runtime Environment (build 1.8.0_111-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14,mixed mode) 原文链接:https://www.f2er.com/centos/379941.html