Using SDKMAN on Windows

1 min read ⚡️🌿 BuddingLast Updated: 05 Nov 2021
cover

What is SDKMAN?

SDKMAN is a tool to manage multiple Software Development Kits in parallel on most Unix-based systems. It includes an easy-to-use Command Line Interface (CLI) and API for installing, switching, removing, and listing Candidates. Having used it on Mac machine to develop and maintain microservices written in different versions of Java, I am amazed by the ease of switching JDKs on the fly.

SDKMAN is built for unix systems. Installing it on Windows is not impossible, but it can be quite cumbersome. There are several ways to do it and you can refer to the references section to see how others do it. Below are the steps that I find work best for my setup. If you are using an unix-based machine, you can check out the quick guide over here.

Steps

  1. Install Chocolatey
  2. Install Git for Windows choco install git
  3. Install Zip choco install git
  4. Install SDKMAN in a custom project folder in C drive.
 export SDKMAN_DIR="/c/project/lib/sdkman" && curl -s "https://get.sdkman.io" | bash
 curl -s "https://get.sdkman.io" | bash
  1. Update current shell environment source ~/.bashrc

Install SDK

Java

  • Install my commonly used JDK versions
sdk install java 8.0.302-open

sdk install java 11.0.2-open

sdk install java 17.0.1-open

Gradle

  • Install my commonly used Gradle versions
sdk install gradle 4.2.1

sdk install gradle 6.9.1

Maven

  • Install maven
sdk install maven

Additional Steps

  • Uninstall the JDKs in old locations and remove the environment variables accordingly since we can use SDKMAN to handle the SDKs from now on.
  • Change your IDEs like Intellij, VSCode to use Git Bash by default
  • Change Windows Terminal to use Git Bash by default

Alternatives and Other Programming Languages

SDKMAN can cover most of your needs if you are solely working with Java, or related languages like Kotlin. Alternatively, you can also try jenv. For other programming languages, check out this awesome list of version managers.

References

It makes my day when I see it.
😊
←Drawing with Walter SeriesUsing SDKMAN on Mac→
Walter Teng © 2021