1.下载安装java(http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html)
$ sudo mkdir -p /usr/lib/jvm $ sudo tar zxf jdk-8u144-linux-x64.tar.gz -C /usr/lib/jvm/ $ sudo chown -R root:root /usr/lib/jvm/jdk1.8.0_144 $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.8.0_144/bin/java" 1 $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.8.0_144/bin/javac" 1 $ sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.8.0_144/bin/jar" 1 $ sudo update-alternatives --install "/usr/bin/javah" "javah" "/usr/lib/jvm/jdk1.8.0_144/bin/javah" 1 $ sudo chmod a+x /usr/bin/java $ sudo chmod a+x /usr/bin/javac $ sudo chmod a+x /usr/bin/jar $ sudo chmod a+x /usr/bin/javah $ sudo update-alternatives --config java $ sudo update-alternatives --config javac $ sudo update-alternatives --config jar $ sudo update-alternatives --config javah $ java -version