Bootstrap
本文主要介绍在Ubuntu中安装Java Jdk10的安装命令和手动下载安装方法。

1、Ubuntu中JDK10的安装命令

sudo apt-get install openjdk-11-jdk

2、通过PPA源安装

1)安装JDK10

sudo add-apt-repository ppa:linuxuprising/java
sudo apt-get update
sudo apt-get install oracle-java10-installer

2)设置为默认值

sudo apt-get install oracle-java10-set-default

3、Ubuntu中手动下载安装JDK10

1)下载安装文件

下载地址https://jdk.java.net/10/

2)解压安装文件

tar xzvf openjdk-10_linux-x64_bin.tar.gz

3)移动解压的文件到系统已安装JDK的位置

sudo mv jdk-10 /usr/lib/jvm/java-10-openjdk-amd64/

4)更新配置

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-10-openjdk-amd64/bin/java 1
sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/java-10-openjdk-amd64/bin/javac 1

5)更新系统的Java配置并选择JDK 10

$ sudo update-alternatives --config java

here are 3 choices for the alternative java (providing /usr/bin/java).
  Selection    Path                                            Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      auto mode
* 1            /usr/lib/jvm/java-10-openjdk-amd64/bin/java      1         manual mode
  2            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
  3            /usr/lib/jvm/java-9-openjdk-amd64/bin/java       1091      manual mode
Press <enter> to keep the current choice[*], or type selection number: 

6)验证安装

$ java --version

openjdk 10 2018-03-20
OpenJDK Runtime Environment 18.3 (build 10+46)
OpenJDK 64-Bit Server VM 18.3 (build 10+46, mixed mode)