SDKMAN!でOpenJDK 11をインストール
Setup
インストールは以下のコマンドを実行するのみ。
code:sdkman
$ sudo apt install zip # zip コマンド必須
$ source "$HOME/.sdkman/bin/sdkman-init.sh"
SDKMAN!のインストールが完了すると、使用しているシェルに応じて以下のように追記される。
code:.bashrc
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!! export SDKMAN_DIR="/home/perforb/.sdkman"
-s "/home/perforb/.sdkman/bin/sdkman-init.sh" && source "/home/perforb/.sdkman/bin/sdkman-init.sh"
OpenJDK 11をインストールしてみる
code:sdk list
$ sdk list java
================================================================================
Available Java Versions
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
AdoptOpenJDK | | 14.0.1.j9 | adpt | | 14.0.1.j9-adpt
| | 14.0.1.hs | adpt | | 14.0.1.hs-adpt
| | 13.0.2.j9 | adpt | | 13.0.2.j9-adpt
| | 13.0.2.hs | adpt | | 13.0.2.hs-adpt
| | 12.0.2.j9 | adpt | | 12.0.2.j9-adpt
| | 12.0.2.hs | adpt | | 12.0.2.hs-adpt
| | 11.0.7.j9 | adpt | | 11.0.7.j9-adpt
| | 11.0.7.hs | adpt | | 11.0.7.hs-adpt
| | 8.0.252.j9 | adpt | | 8.0.252.j9-adpt
| | 8.0.252.hs | adpt | | 8.0.252.hs-adpt
Amazon | | 11.0.7 | amzn | | 11.0.7-amzn
| | 8.0.252 | amzn | | 8.0.252-amzn
Azul Zulu | | 14.0.1 | zulu | | 14.0.1-zulu
| | 13.0.3 | zulu | | 13.0.3-zulu
| | 13.0.3.fx | zulu | | 13.0.3.fx-zulu
| | 12.0.2 | zulu | | 12.0.2-zulu
| | 11.0.7 | zulu | | 11.0.7-zulu
| | 11.0.7.fx | zulu | | 11.0.7.fx-zulu
| | 10.0.2 | zulu | | 10.0.2-zulu
| | 9.0.7 | zulu | | 9.0.7-zulu
| | 8.0.252 | zulu | | 8.0.252-zulu
| | 8.0.252.fx | zulu | | 8.0.252.fx-zulu
| | 8.0.232.fx | zulu | | 8.0.232.fx-zulu
| | 7.0.262 | zulu | | 7.0.262-zulu
| | 6.0.119 | zulu | | 6.0.119-zulu
BellSoft | | 14.0.1.fx | librca | | 14.0.1.fx-librca
| | 14.0.1 | librca | | 14.0.1-librca
| | 13.0.2.fx | librca | | 13.0.2.fx-librca
| | 13.0.2 | librca | | 13.0.2-librca
| | 12.0.2 | librca | | 12.0.2-librca
| | 11.0.7.fx | librca | | 11.0.7.fx-librca
| | 11.0.7 | librca | | 11.0.7-librca
| | 8.0.252.fx | librca | | 8.0.252.fx-librca
| | 8.0.252 | librca | | 8.0.252-librca
GraalVM | | 20.1.0.r11 | grl | | 20.1.0.r11-grl
| | 20.1.0.r8 | grl | | 20.1.0.r8-grl
| | 20.0.0.r11 | grl | | 20.0.0.r11-grl
| | 20.0.0.r8 | grl | | 20.0.0.r8-grl
| | 19.3.1.r11 | grl | | 19.3.1.r11-grl
| | 19.3.1.r8 | grl | | 19.3.1.r8-grl
Java.net | | 16.ea.4 | open | | 16.ea.4-open
| | 15.ea.30 | open | | 15.ea.30-open
| | 14.0.1 | open | | 14.0.1-open
| | 13.0.2 | open | | 13.0.2-open
| | 12.0.2 | open | | 12.0.2-open
| >>> | 11.0.7 | open | installed | 11.0.7-open
| | 10.0.2 | open | | 10.0.2-open
| | 9.0.4 | open | | 9.0.4-open
| | 8.0.252 | open | | 8.0.252-open
SAP | | 14.0.1 | sapmchn | | 14.0.1-sapmchn
| | 13.0.2 | sapmchn | | 13.0.2-sapmchn
| | 12.0.2 | sapmchn | | 12.0.2-sapmchn
| | 11.0.7 | sapmchn | | 11.0.7-sapmchn
================================================================================
Use the Identifier for installation:
$ sdk install java 11.0.3.hs-adpt
================================================================================
code:sdk install
$ sdk install java 11.0.7-open
code:sdk use
$ sdk use java 11.0.7-open
code:before
$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment (build 11.0.7+10-post-Ubuntu-3ubuntu1)
OpenJDK 64-Bit Server VM (build 11.0.7+10-post-Ubuntu-3ubuntu1, mixed mode, sharing)
code:after
$ java -version
openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment 18.9 (build 11.0.7+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.7+10, mixed mode)
JAVA_HOMEはどうなるか
code:test
$ echo $JAVA_HOME
/home/perforb/.sdkman/candidates/java/current
このようにSDKMAN!でインストールしたJavaを向くようになる。
cf.