How to install SDKMan on macOS¶
SDK man installation is OS agnostic and it has support for Unix based distribution like described in: https://sdkman.io/install
How to install Java with SDKMan¶
Show posible java candidates
$ sdk list java
$ ================================================================================
Available Java Versions for macOS ARM 64bit
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
Corretto | | 20 | amzn | | 20-amzn
| | 20.0.1 | amzn | | 20.0.1-amzn
| | 19.0.2 | amzn | | 19.0.2-amzn
| | 19.0.1 | amzn | | 19.0.1-amzn
Install the latest
$ sdk install java
Optinally install java 8
$ sdk install java 8.0.362-zulu
Switch Java versions with SDK environments¶
Set a sdk environment to your folder
$ sdk env init
.sdkmanrc created.
Modify the sdkmanrc file according to the java version you want to specify
$ cat .sdkmanrc
# Enable auto-env through the sdkman_auto_env config
# Add key=value pairs of SDKs to use below
java=8.0.362-zulu
Active the sdk environment whenever you need to change java version for the current shell session