In this blog post, we'll discuss why it's crucial to use an SDK manager as a java developer and how to install and switch between JDKs in a few seconds.
Why should you use an SDK manager, and why is SDKMAN a crucial tool for a Java developer?#
As a Java developer, it is common to work with different versions of Java:
- To try out new features in the latest JDK.
- To work on new services that run on the current LTS JDK.
- To fix bugs in legacy services that cannot be migrated from Java 8.
Switching between different JDKs and updating the current JDK involves updating the JAVA_HOME environment variable and symlinks to the Java binaries.
To simplify this process, SDKMAN comes to the rescue. SDKMAN is a lightweight software written in Bash that requires only curl and zip/unzip to install, uninstall, update, or switch your JDKs.
Installing SDKMAN#
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"To verify the installation, type: (as a result version should be printed i.e. SDKMAN 5.15.0):
sdk versionUsing SDKMAN#
Finding the necessary JDK To discover all available distributions of JDKs, use the following command:
sdk list javaThe result will be a vast list of different JDK types, starting with Java 1.7 and ending with the latest releases.

sdk list java — available JDK distributions Installing JDK 19 and GraalVM 22.3 with Java 19
Installing JDK 19
sdk install java 19.0.1-amznInstalling GraalVM 22.3 with Java 19
sdk install java 22.3.r19-grl
SDKMAN comes with an auto-complete feature that lets you fill in the Java version by pressing Tab.

- Switching between Java versions
To switch between installed JDKs, use the
defaultcommand:
sdk default java 19.0.1-amznThis will update the symlinks and JAVA_HOME to the 19.0.1-amzn JDK
or
sdk default java 22.3.r19-grlThis will update the symlinks and JAVA_HOME to the 22.3.r19-grl JDK
Conclusion#
If you have to work with multiple JDK, SDKMAN is a perfect tool that allows easily to manage JDKs, update existing JDK to the latest security patches, and switch quickly between various versions of java. Apart from being in change of JDKs, SDKMAN can manage different build toolss like maven, gradle,ant, etc. that can be useful for someone.