avatar JK Park
Jan 3, 2019
Install JDK11
Contents

Installing JDK11

JDK를 설치하는 방법은 apt-get install default-jdk만 하면 된다. 하지만 설치되는 jdk의 버전은 10.0.2이다.

$ sudo apt-get install default-jdk
$ java --version
openjdk 10.0.2 2018-07-17
OpenJDK Runtime Environment (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4)
OpenJDK 64-Bit Server VM (build 10.0.2+13-Ubuntu-1ubuntu0.18.04.4, mixed mode)

나는 jdk11을 설치하기 위해 수동으로 설치한다.

$ cd ~/Downloads
$ wget https://download.java.net/java/GA/jdk11/13/GPL/openjdk-11.0.1_linux-x64_bin.tar.gz
$ sudo mkdir /usr/lib/jvm
$ sudo tar zxvf openjdk-11.0.1_linux-x64_bin.tar.gz --directory /usr/lib/jvm

확인

$ /usr/lib/jvm/jdk-11.0.1/bin/java --version
openjdk 11.0.1 2018-10-16
OpenJDK Runtime Environment 18.9 (build 11.0.1+13)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.1+13, mixed mode)

alternatives update

$ sudo sh -c 'for bin in /usr/lib/jvm/jdk-11.0.1/bin/*; do update-alternatives --install /usr/bin/$(basename $bin) $(basename $bin) $bin 100; done'
$ sudo sh -c 'for bin in /usr/lib/jvm/jdk-11.0.1/bin/*; do update-alternatives --set $(basename $bin) $bin; done'

확인

$ sudo update-alternatives --config java
There is 1 choice for the alternative java (providing /usr/bin/java).

  Selection    Path                              Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/jdk-11.0.1/bin/java   100       auto mode
* 1            /usr/lib/jvm/jdk-11.0.1/bin/java   100       manual mode