安装sdkman
// 安装sdkman
curl -s "https://get.sdkman.io" | bash
//成功运行后,屏幕显示下面信息
All done!
Please open a new terminal, or run the following in the existing one:
source "/Users/xxxx/.sdkman/bin/sdkman-init.sh"
Then issue the following command:
sdk help
安装java
// 查看java版本
sdk list java
================================================================================
Available Java Versions
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
AdoptOpenJDK | | 12.0.1.j9 | adpt | | 12.0.1.j9-adpt
| | 12.0.1.hs | adpt | | 12.0.1.hs-adpt
| | 11.0.4.j9 | adpt | | 11.0.4.j9-adpt
| | 11.0.4.hs | adpt | | 11.0.4.hs-adpt
| | 8.0.222.j9 | adpt | | 8.0.222.j9-adpt
| | 8.0.222.hs | adpt | | 8.0.222.hs-adpt
Amazon | | 11.0.4 | amzn | | 11.0.4-amzn
| | 8.0.222 | amzn | | 8.0.222-amzn
| | 8.0.202 | amzn | | 8.0.202-amzn
Azul Zulu | | 12.0.2 | zulu | | 12.0.2-zulu
| | 11.0.4 | zulu | | 11.0.4-zulu
| | 10.0.2 | zulu | | 10.0.2-zulu
| | 9.0.7 | zulu | | 9.0.7-zulu
| | 8.0.222 | zulu | | 8.0.222-zulu
| | 8.0.202 | zulu | | 8.0.202-zulu
| | 7.0.232 | zulu | | 7.0.232-zulu
| | 7.0.181 | zulu | | 7.0.181-zulu
Azul ZuluFX | | 11.0.2 | zulufx | | 11.0.2-zulufx
| | 8.0.202 | zulufx | | 8.0.202-zulufx
BellSoft | | 12.0.2 | librca | | 12.0.2-librca
| | 11.0.4 | librca | | 11.0.4-librca
| | 8.0.222 | librca | | 8.0.222-librca
GraalVM | | 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 | | 14.ea.6 | open | | 14.ea.6-open
| | 13.ea.30 | open | | 13.ea.30-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 | | 12.0.2 | sapmchn | | 12.0.2-sapmchn
| | 11.0.4 | sapmchn | | 11.0.4-sapmchn
================================================================================
// 安装java8
sdk install java 8.0.222-zulu
// 安装java11
sdk install java 11.0.4-zulu
切换java版本
// 使用指定版本
sdk use java 8.0.222-zulu
// 设置默认版本
sdk default java 11.0.4-zulu
参考文章
https://wimdeblauwe.wordpress.com/2018/09/26/switching-between-jdk-8-and-11-using-sdkman/
网友评论