安装步骤: wget http://10.107.2.44/jdk-8u111-linux-x64.tar.gz root@ute-image:~# tar zxf jdk-8u111-linux-x64.tar.gz root@ute-image:~# mv jdk1.8.0_111/ /usr/lib/jvm/ root@ute-image:~# vi /etc/profile //添加本地变量,在最后一行 export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_111/ export JRE_HOME=${JAVA_HOME}/jre export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib export PATH=${JAVA_HOME}/bin:$PATH root@ute-image:~# source /etc/profile root@ute-image:~# update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.0_111/jre/bin/java 1100 root@ute-image:~# update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.0_111/bin/javac 1100 root@ute-image:~# update-alternatives --config java There are 2 choices for the alternative java (providing /usr/bin/java). Selection Path root@ute-image:~# update-alternatives --config javac There are 2 choices for the alternative javac (providing /usr/bin/javac). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/jdk1.8.0_111/bin/javac 1100 auto mode 1 /usr/lib/jvm/j2sdk1.7-oracle/bin/javac 317 manual mode 2 /usr/lib/jvm/jdk1.8.0_111/bin/javac 1100 manual mode Press enter to keep the current choice[*], or type selection number: Priority Status ------------------------------------------------------------ * 0 /usr/lib/jvm/jdk1.8.0_111/jre/bin/java 1100 auto mode 1 /usr/lib/jvm/j2sdk1.7-oracle/jre/bin/java 317 manual mode 2 /usr/lib/jvm/jdk1.8.0_111/jre/bin/java 1100 manual mode Press enter to keep the current choice[*], or type selection number: java8