#这里找下载路径
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
# 下载
rpm -ivh --force jdk-6u37-linux-amd64.rpm
rpm -ivh --force jdk-7u79.rpm
alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_79/bin/java 7
alternatives --config java
而是骗子
#这个不行啊
#update-alternatives --install /usr/java/latest java /usr/java/jdk1.6.0_37 6
#update-alternatives --install /usr/java/latest java /usr/java/jdk1.7.0_79/bin/java 7
#update-alternatives --install /usr/java/latest java /usr/java/jdk1.8.0_51 8
#这个
#alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_79 7
#alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_79 7
#alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_79 7
切换命令:
alternatives --config java
##remove
#alternatives --remove java /usr/java/jdk1.6.0_37
#alternatives --remove java /usr/java/jdk1.7.0_79
##如果切换后不行么
#vi /etc/profile 文件末尾添加下面内容:
#set environment variable
export JAVA_HOME=/usr/java/jdk1.7.0
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
保存退出后
source /etc/profie
#或者 ”.“后是空格
. /etc/profile