此文只讲终端如何操作,jdk的安装及切换。
打开终端:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java6-installer
(安装java7或者java8,则将上面的6改成7、8即可)
安装完成后,使用java6、7、8.则 切换一下:
sudo update-alternatives --config java
弹出的选项,输入相应的序号就可以了。
~/code/4.4/frameworks/base$ sudo update-alternatives --config java There are 4 choices for the alternative java (providing /usr/bin/java). Selection Path Priority Status ------------------------------------------------------------ 0 /usr/lib/jvm/java-6-oracle/jre/bin/java 1002 auto mode 1 /usr/lib/jvm/java-6-oracle/jre/bin/java 1002 manual mode 2 /usr/lib/jvm/java-7-openjdk-amd64/bin/java 1001 manual mode 3 /usr/lib/jvm/java-7-oracle/jre/bin/java 1 manual mode * 4 /usr/lib/jvm/java-8-openjdk-amd64/bin/java 100 manual mode Press enter to keep the current choice[*],or type selection number:原文链接:https://www.f2er.com/ubuntu/356138.html