安装Oracle JDK8
$ sudo apt-get install python-software-properties
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer
设置环境变量
$ sudo apt-get install oracle-java8-set-default
检查是否成功
$ java -version
java version"1.8.0_111"
Java(TM) SE Runtime Environment (build 1.8.0_111-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.111-b14, mixed mode)
补充
如果想尝鲜JDK9,把对应命令改变即可
$ sudo apt-get install oracle-java9-installer
$ sudo apt-get install oracle-java9-set-default
网友评论