使用 SDKMAN! 管理 JDK

Java SDKMAN About 5,354 words

安装

curl -s "https://get.sdkman.io" | bash

备注

如果无法下载,/etc/hosts中需添加GitHub域名解析。

140.82.121.3    github.com

查看 JDK 信息

Status这列标识是否安装,是否是本地下载的。

IdentifierJDK的版本信息。

sdk list java

输出

================================================================================
Available Java Versions for macOS ARM 64bit
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 Corretto      |     | 20.0.1       | amzn    |            | 20.0.1-amzn
               | >>> | 17.0.7       | amzn    | installed  | 17.0.7-amzn
               |     | 11.0.19      | amzn    |            | 11.0.19-amzn
               |     | 8.0.372      | amzn    |            | 8.0.372-amzn
 Gluon         |     | 22.1.0.1.r17 | gln     |            | 22.1.0.1.r17-gln
               |     | 22.1.0.1.r11 | gln     |            | 22.1.0.1.r11-gln
 GraalVM CE    |     | 20.0.1       | graalce |            | 20.0.1-graalce
               |     | 17.0.7       | graalce |            | 17.0.7-graalce
 GraalVM Oracle|     | 20.0.1       | graal   |            | 20.0.1-graal
               |     | 17.0.7       | graal   |            | 17.0.7-graal
 Java.net      |     | 22.ea.5      | open    |            | 22.ea.5-open
               |     | 22.ea.4      | open    |            | 22.ea.4-open
               |     | 22.ea.3      | open    |            | 22.ea.3-open
               |     | 21.ea.30     | open    |            | 21.ea.30-open
               |     | 21.ea.29     | open    |            | 21.ea.29-open
               |     | 21.ea.28     | open    |            | 21.ea.28-open
 JetBrains     |     | 17.0.7       | jbr     |            | 17.0.7-jbr
               |     | 11.0.14.1    | jbr     |            | 11.0.14.1-jbr
 Liberica      |     | 20.0.1.fx    | librca  |            | 20.0.1.fx-librca
               |     | 20.0.1       | librca  |            | 20.0.1-librca
               |     | 17.0.7.fx    | librca  |            | 17.0.7.fx-librca
               |     | 17.0.7       | librca  |            | 17.0.7-librca
               |     | 11.0.19.fx   | librca  |            | 11.0.19.fx-librca
               |     | 11.0.19      | librca  |            | 11.0.19-librca
               |     | 8.0.372.fx   | librca  |            | 8.0.372.fx-librca
               |     | 8.0.372      | librca  |            | 8.0.372-librca
 Liberica NIK  |     | 23.r20       | nik     |            | 23.r20-nik
               |     | 23.r17       | nik     |            | 23.r17-nik
               |     | 22.3.2.r17   | nik     |            | 22.3.2.r17-nik
               |     | 22.3.2.r11   | nik     |            | 22.3.2.r11-nik
 Microsoft     |     | 17.0.7       | ms      |            | 17.0.7-ms
               |     | 11.0.19      | ms      |            | 11.0.19-ms
 Oracle        |     | 20.0.1       | oracle  |            | 20.0.1-oracle
               |     | 17.0.7       | oracle  |            | 17.0.7-oracle
 SapMachine    |     | 20.0.1       | sapmchn |            | 20.0.1-sapmchn
               |     | 17.0.7       | sapmchn |            | 17.0.7-sapmchn
               |     | 11.0.19      | sapmchn |            | 11.0.19-sapmchn
 Semeru        |     | 20.0.1       | sem     |            | 20.0.1-sem
               |     | 17.0.7       | sem     |            | 17.0.7-sem
               |     | 11.0.19      | sem     |            | 11.0.19-sem
 Temurin       |     | 20.0.1       | tem     |            | 20.0.1-tem
               |     | 17.0.7       | tem     |            | 17.0.7-tem
               |     | 11.0.19      | tem     |            | 11.0.19-tem
               |     | 11.0.17      | tem     | local only | 11.0.17-tem
 Tencent       |     | 17.0.7       | kona    |            | 17.0.7-kona
               |     | 11.0.19      | kona    |            | 11.0.19-kona
               |     | 8.0.372      | kona    |            | 8.0.372-kona
 Zulu          |     | 20.0.1       | zulu    |            | 20.0.1-zulu
               |     | 20.0.1.fx    | zulu    |            | 20.0.1.fx-zulu
               |     | 17.0.7       | zulu    |            | 17.0.7-zulu
               |     | 17.0.7.fx    | zulu    |            | 17.0.7.fx-zulu
               |     | 11.0.19      | zulu    |            | 11.0.19-zulu
               |     | 11.0.19.fx   | zulu    |            | 11.0.19.fx-zulu
               |     | 8.0.372      | zulu    |            | 8.0.372-zulu
               |     | 8.0.372.fx   | zulu    |            | 8.0.372.fx-zulu
 Unclassified  |     | 22.3.r17     | none    | local only | 22.3.r17-grl
================================================================================
Omit Identifier to install default version 17.0.7-tem:
    $ sdk install java
Use TAB completion to discover available versions
    $ sdk install java [TAB]
Or install a specific version by Identifier:
    $ sdk install java 17.0.7-tem
Hit Q to exit this list view
================================================================================

查看当前使用的 JDK

sdk current

安装指定的 JDK 版本

版本是Identifier这列中的数值。

sdk install java 17.0.7-amzn

卸载指定 JDK 版本

sdk uninstall java 17.0.7-amzn

使用指定 JDK 版本

sdk use java 17.0.7-amzn

查看帮助

sdk help

文档

https://sdkman.io

Views: 843 · Posted: 2023-09-08

————        END        ————

Give me a Star, Thanks:)

https://github.com/fendoudebb/LiteNote

扫描下方二维码关注公众号和小程序↓↓↓

扫描下方二维码关注公众号和小程序↓↓↓


Today On History
Browsing Refresh