SDKMAN 有一个名为“安装本地版本”(https://sdkman.io/usage#localversion)的功能。
因此,要使用 SDKMAN 设置 JDK 的自定义构建,我可以下载并安装 JDK,然后将其链接到 SDKMAN,这样它就可以像 SDKMAN 管理的任何其他 JDK 一样使用:
wget https://download.java.net/java/early_access/loom/7/openjdk-18-loom+7-288_linux-x64_bin.tar.gz
tar -xf openjdk-18-loom+7-288_linux-x64_bin.tar.gz
mv jdk-18/ 18-loom
sdk install java 18-loom $(realpath 18-loom/)
安装和链接后:
~/javas > sdk default java 18-loom
Default java version set to 18-loom
~/javas > which java
/home/matt/.sdkman/candidates/java/current/bin/java
~/javas > java --version
openjdk 18-loom 2022-03-15
OpenJDK Runtime Environment (build 18-loom+7-288)
OpenJDK 64-Bit Server VM (build 18-loom+7-288, mixed mode, sharing)