1.卸载jdk
rpm -qa |grep java
rpm -e --nodeps xxx
2.解压jdk-8u11-linux-x64.tar.gz文件
tar -zxvf jdk-8u11-linux-x64.tar.gz
3.创建java目录
mkdir /usr/local/java
mv jdk1.8.0_11/ /usr/local/java/
4.配置环境变量
vim /etc/profile
JAVA_HOME=/usr/local/java/jdk1.8.0_11/
JRE_HOME=$JAVA_HOME/jre
CLASSPATH=.:$JAVA_HOME/lib:/dt.jar:$JAVA_HOME/lib/tools.jar
PATH=$PATH:$JAVA_HOME/bin
export JAVA_HOME
export JRE_HOME
export CLASSPATH
export PATH
5.使环境变量生效,测试
source /etc/profile
java -version