1.添加仓库
在终端执行一下命令
sudo add-apt-repository ppa:openjdk-r/ppa
2.升级系统资源包并安装openjdk1.8
sudo apt-get update
sudo apt-get install openjdk-8-jdk
3.配置openjdk1.8
openjdk默认会安装在/usr/lib/jvm/java-8-openjdk-amd64,可以在~/.bashrc文件中进行jdk的配置
#export JAVA_HOME=/usr/lib/java/jdk6u45
#export JAVA_HOME=/usr/lib/java/jdk8u91
#export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
#export JAVA_HOME=/usr/lib/java/jdk7u79
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
参考资料
http://blog.csdn.net/weirdo_c/article/details/50927712