https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
国内镜像:
https://repo.huaweicloud.com/java/jdk/8u191-b12/
https://mirrors.yangxingzhen.com/jdk/
检查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
原文:https://www.cnblogs.com/tomtellyou/p/11777143.html