1.将下载的JDK压缩包解压到/usr/lib/jvm
2.运行以下命令
sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.8.*/bin/java 1065
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.8.*/bin/javac 1065
sudo update-alternatives --install /usr/bin/jar jar /usr/lib/jvm/jdk1.8.*/bin/jar 1065
sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.8.*/bin/javaws 1065
3.然后运行以下命令,并选择你需要的JDK
sudo update-alternatives --config java
sudo update-alternatives --config javac
sudo update-alternatives --config javaws