卸载自带jdk
查看java 版本
java -version
查看jdk安装情况
rpm -qa | grep -i java
卸载
yum remove *openjdk*
yum安装open-jdk
安装前更改yun源为阿里云
列出jdk安装列表
yum list java*
安装jdk8
yum install -y java-1.8.0-openjdk.x86_64
# 查看java安装目录
whereis java
java: /usr/bin/java /usr/lib/java /etc/java /usr/share/java /usr/share/man/man1/java.1.gz
which java
/usr/bin/java
安装Oracle JDK
下载oarcle jdk https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
# 解压
tar -zxvf jdk-8u171-linux-x64.tar.gz
#配置环境变量
vim /etc/profile
export JAVA_HOME=/usr/bin/java
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
# 配置生效
source /etc/profile
网友评论