安装sdkman
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk version
正常出现sdkman版本号就安装成功了
# 安装java
# 安装java8
sdk install java 8.0.412.fx-zulu
建议和上述一样安装 fx-zulu 的jdk,这样会自带JAVAFX,方便后续使用java工具
ln -s ~/.sdkman/candidates/java/8.0.412.fx-zulu ~/.sdkman/candidates/java/8
sdk use java 8
java -version
# 安装jdk11
sdk install java 11.0.23.fx-zulu
ln -s ~/.sdkman/candidates/java/11.0.23.fx-zulu ~/.sdkman/candidates/java/11
sdk use java 11
java -version
# 安装jdk22
sdk install java 22.0.1.fx-zulu
ln -s ~/.sdkman/candidates/java/22.0.1.fx-zulu ~/.sdkman/candidates/java/22
sdk use java 22
java -version
# 版本切换
切换java8
sdk use java 8
java -version
切换java11
sdk use java 11
java -version
切换java22
sdk use java 22
java -version