SDKMAN
SDKMAN简介
JDK版本迭代太快,多个版本手动改 JAVA_HOME
太痛苦。
安装 SDKMAN
windows 安装需要 bash, zip, unzip, curl。
包含关系:
chocolatey(Windows的包管理工具)
- zip
- unzip
git bash(Windows的git终端)
- bash
- curl
C:\> choco install unzip
C:\> choco install zip
# 安装Git
# 打开 Git bash 终端,执行命令:
curl -s "https://get.sdkman.io" | bash
[root@master ~]# sdk ls 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
| | 8.0.242 | amzn | | 8.0.242-amzn
Azul Zulu | | 14.0.0 | zulu | | 14.0.0-zulu
| | 13.0.2 | zulu | | 13.0.2-zulu
| | 12.0.2 | zulu | | 12.0.2-zulu
| | 11.0.6 | zulu | | 11.0.6-zulu
| | 11.0.5.fx | zulu | | 11.0.5.fx-zulu
| | 10.0.2 | zulu | | 10.0.2-zulu
| | 9.0.7 | zulu | | 9.0.7-zulu
| | 8.0.242 | zulu | | 8.0.242-zulu
| | 8.0.232.fx | zulu | | 8.0.232.fx-zulu
| | 7.0.242 | zulu | | 7.0.242-zulu
| | 6.0.119 | zulu | | 6.0.119-zulu
BellSoft | | 14.0.0.fx | librca | | 14.0.0.fx-librca
| | 14.0.0 | librca | | 14.0.0-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.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.6 | open | | 11.0.6-open
| | 10.0.2 | open | | 10.0.2-open
| | 9.0.4 | open | | 9.0.4-open
| | 8.0.242 | open | | 8.0.242-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
[root@master ~]# sdk install java 8.0.242.hs-adpt
切换默认版本
sdk default java 11.0.5.hs-adpt
临时切换版本
如果只想在当前的 shell 中临时使用与默认 JDK 不同的版本,使用 sdk use
命令。比如,我就是想临时试一下 JDK 8,可以用下面的命令。
$ sdk use java 8.0.232.hs-adpt
其它 SDK
除了 JDK 之外,SDKMAIN!还可以安装其它 Java 相关的 SDK,包括 Scala、Kotlin、Groovy、Spring Boot、Maven、sbt 和 Gradle 等。比如,下面的命令可以列出来全部的 Maven
版本。再使用 sdk install maven
进行安装即可。
$ sdk ls maven