3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

#Java: vol1: 【 java・JDKバージョン管理 ベストプラクティス 】

Last updated at Posted at 2020-04-01

#Java: vol1: 【 java・JDKバージョン管理 ベストプラクティス 】

背景

jdk 1.8.0 系のプロジェクトと個人で、最新のjavaとscalaを使用する際にバージョンの切替が必要になりました。
jEnvを使用していたのですが、設定が複雑だったので見直したところ sdkman というバージョン管理ツールがありとても使いやすかったのでご紹介します。

sdkman インストール方法

sdkman インストール方法

curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
➜  ~ sdk list java                    
================================================================================
Available Java Versions
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 AdoptOpenJDK  |     | 14.0.0.j9    | adpt    |            | 14.0.0.j9-adpt
               |     | 14.0.0.hs    | adpt    |            | 14.0.0.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.6.j9    | adpt    |            | 11.0.6.j9-adpt
               |     | 11.0.6.hs    | adpt    |            | 11.0.6.hs-adpt
               |     | 8.0.242.j9   | adpt    |            | 8.0.242.j9-adpt
               |     | 8.0.242.hs   | adpt    |            | 8.0.242.hs-adpt
 Amazon        |     | 11.0.6       | amzn    |            | 11.0.6-amzn
               |     | 13.0.2       | librca  |            | 13.0.2-librca
               |     | 12.0.2       | librca  |            | 12.0.2-librca
               |     | 11.0.6.fx    | librca  |            | 11.0.6.fx-librca
               |     | 11.0.6       | librca  |            | 11.0.6-librca
               |     | 8.0.242.fx   | librca  |            | 8.0.242.fx-librca
               |     | 8.0.242      | librca  |            | 8.0.242-librca
 GraalVM       |     | 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
               |     | 19.3.0.r11   | grl     |            | 19.3.0.r11-grl
               |     | 19.3.0.r8    | grl     |            | 19.3.0.r8-grl
               |     | 19.3.0.2.r11 | grl     |            | 19.3.0.2.r11-grl
               |     | 19.3.0.2.r8  | grl     |            | 19.3.0.2.r8-grl
               |     | 19.2.1       | grl     |            | 19.2.1-grl
               |     | 19.1.1       | grl     |            | 19.1.1-grl
               |     | 19.0.2       | grl     |            | 19.0.2-grl
               |     | 1.0.0        | grl     |            | 1.0.0-rc-16-grl
 Java.net      |     | 15.ea.15     | open    |            | 15.ea.15-open
               |     | 14.0.0       | open    |            | 14.0.0-open
               |     | 13.0.2       | open    |            | 13.0.2-open
               |     | 12.0.2       | open    |            | 12.0.2-open
               |     | 11.0.2       | open    |            | 11.0.2-open
               |     | 10.0.2       | open    |            | 10.0.2-open
               |     | 9.0.4        | open    |            | 9.0.4-open
 SAP           |     | 13.0.2       | sapmchn |            | 13.0.2-sapmchn
               |     | 12.0.2       | sapmchn |            | 12.0.2-sapmchn
               |     | 11.0.6       | sapmchn |            | 11.0.6-sapmchn
================================================================================
Use the Identifier for installation:

    $ sdk install java 11.0.3.hs-adpt
================================================================================

JDK 1.8.0 インストール方法

sdkmanを使用してjavaをインストール

sdk install java 8.0.242.j9-adpt

➜  ~ java -version                                                                                                                                                                                                                              ()
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b08)
Eclipse OpenJ9 VM (build openj9-0.18.1, JRE 1.8.0 Mac OS X amd64-64-Bit Compressed References 20200122_439 (JIT enabled, AOT enabled)
OpenJ9   - 51a5857d2
OMR      - 7a1b0239a
JCL      - 8cf8a30581 based on jdk8u242-b08)

サポート一覧

sdkman は, 他にもさまざまなJDK・SDKをサポートしています。
詳細は以下を参照してください

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?