Install Java JDK on MacOS with SDKMan

From Bonus Bits
Jump to: navigation, search

Purpose

This article gives the steps to install a single or multiple versions of Java Development Kit (JDK) using SDKMan.


Prerequisites

List Available Versions

  1. sdk list java
    

Example

================================================================================
Available Java Versions
================================================================================
     13.ea.07-open       8.0.202.hs-adpt
     12.ea.31-open       8.0.202-zulufx
     11.0.2-zulufx   > * 8.0.201-oracle
     11.0.2-sapmchn      7.0.181-zulu
     11.0.2-zulu         1.0.0-rc-12-grl
     11.0.2-open         1.0.0-rc-11-grl
     11.0.2.j9-adpt      1.0.0-rc-10-grl
     11.0.2.hs-adpt      1.0.0-rc-9-grl
     10.0.2-zulu         1.0.0-rc-8-grl
     10.0.2-open
     9.0.7-zulu
     9.0.4-open
     8.0.202-zulu
     8.0.202-amzn
     8.0.202.j9-adpt

================================================================================
+ - local version
* - installed
> - currently in use
================================================================================


Install

  1. sdk install java 8.0.201-oracle
    
    1. IF you pick the oracle version you have to enter y <enter> to accept license agreement.


Switch Versions Temporarily on CLI

You can have multiple versions installed and SDK will handle the environment variable switching when you wish to change default versions.

  1. sdk current java 11.0.2-open
    


Switch Version Default on CLI

You can have multiple versions installed and SDK will handle the environment variable switching when you wish to change default versions.

  1. sdk default java 11.0.2-open
    

Uninstall

  1. sdk uninstall java 8.0.201-oracle
    


Related Articles