环境准备
JDK下载
卸载openjdk
rpm -qa|grep java
sudo rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.222.b03-1.el7.x86_64
sudo rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.221-2.6.18.1.el7.x86_64
sudo rpm -e --nodeps java-1.8.0-openjdk-1.8.0.222.b03-1.el7.x86_64
sudo rpm -e --nodeps java-1.7.0-openjdk-1.7.0.221-2.6.18.1.el7.x86_64
安装配置Jdk1.8
tar -vzxf jdk-8u191-linux-x64.tar.gz
修改配置文件
sudo vim /etc/profile
export JAVA_HOME=/home/bbzz/software/jdk1.8.0_191
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
生效配置文件
source /etc/profile
验证
java -version