1.安装Java
ppa仓库:https://launchpad.net/~webupd8team/+archive/ubuntu/java
通过ppa仓库安装:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
如果要安装Oracle Java 8,直接将
sudo apt-get install oracle-java7-installer
改为
sudo apt-get install oracle-java8-installer
通过source.list安装
sudo vim /etc/apt/sources.list
在里面添加(针对于Ubuntu 15.10):
deb http://ppa.launchpad.net/webupd8team/java/ubuntu wily main
deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu wily main
然后执行:
sudo apt-get update
sudo apt-get install oracle-java7-installer
2. 选择默认的java版本
命令行:
sudo update-alternatives --config java
窗口:
sudo galternatives