安装openJDK 7
sudo apt-get install openjdk-7-jdk
安装openJDK 8
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
执行之后查看
sudo update-alternatives --config Java
sudo apt-get install openjdk-7-jdk
sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --config Java