Java Version Manager - How to install multiple JDK Versions

Learn how to install multiple versions of JDK on MAC. You can use SDKMan to switch between multiple JDK Versions.

There are instances when you are working on multiple JAVA projects in parallel, each one having a different JDK Version. This is a situation where the need for a Java Version Manager becomes very important because it allows you to easily switch between JDK versions without having to do any installations.

I recently had a similar experience, where I was working on three services each one having a different JDK requirement. The first one was running Java 1.8, the second one was on 11 and the third one was on 17. Since I will be working on these services for a long time, installing and uninstalling JDKs every time I work on a specific service doesn’t make sense.

So, after a bit of searching, I found SDKMan, which quickly became my favourite superhero :)

Note: If you are interested in knowing how you can Design a Parking Lot using Java, please head to Interrupt.Club.

SDKMan stands for Software Development Kit Manager. It allows you to install many software development kits like JDK, Maven, Gradle, etc. It also allows you to install different versions of such Kits in parallel and you can easily switch between them.

How to use SDKMan for JDK Version Management on Mac

  1. Install SDKMan by running the command
curl -s "" | bash
  1. Once, SDKMan is installed verify if its path is added to your .zshrc file or not.
  2. Run the command sdk version to see if it’s working fine or not.
  3. Run the command sdk list java to see all the available versions of java. Copy the identifier of the version you want to install.
  4. Run the command sdk install java INDETIFIER_COPIED_ABOVE. This will install the version of JDK that you have copied in the line above.

You can use the step above to install multiple Java JDK versions on MacOS. Once, you have installed multiple JDK versions you can easily switch between them using the command below.

Switch Between JDK Versions using SDKMan


So, this is how you can easily switch between JDK Version using SDKMan which is a Java Version Manager tool here.