https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.htmlhtml
國內鏡像:
https://repo.huaweicloud.com/java/jdk/8u191-b12/
https://mirrors.yangxingzhen.com/jdk/java
檢查openJDK是否安裝命令:rpm -qa|grep jdk (若是有安裝openJDK 那麼除了copy-jdk-configs-3.3-2.el7.noarch文件能夠不用刪除。其餘的openJdk所有要卸載) 卸載命令:yum -y remove xxxx
cd /usr/local
mkdir /usr/local/java
tar -zxvf jdk-8u162-linux-x64.tar.gz -C /usr/local/java
編輯/etc/下的profile文件: vi /etc/profile 在文件末尾添加以下配置: export JAVA_HOME=/usr/local/java/jdk1.8.0_162 export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH
source /etc/profile
java -version