If you’re a Java developer, you’ve probably faced the nightmare of managing multiple JDK versions on your machine. Legacy projects might require Java 8, while modern applications run on Java 17 or 21, and you may even experiment with beta releases. Manually switching between these versions—configuring environment variables and editing your system PATH—is tedious and error-prone. This is where SDKMAN! comes in, revolutionizing SDK management and making your life much easier.
What is SDKMAN!?
SDKMAN! is a powerful open-source tool designed to simplify the installation, updating, and management of technologies in the JVM ecosystem.
Still have doubts? Let’s see it in action!
Installation
Run the following command in your terminal to download and install SDKMAN!:
curl -s "https://get.sdkman.io" | bashAfter installation, load the SDKMAN! initialization script:
source "$HOME/.sdkman/bin/sdkman-init.sh"To verify the installation, run:
sdk versionYou should see output similar to:
SDKMAN!
script: 5.19.0
native: 0.5.0SDKMAN! automatically adds a startup script to your .bashrc or .zshrc file, ensuring the tool is available in all future terminal sessions.
Essential Commands and Practical Usage
Listing Available SDKs
To see all the SDKs and tools SDKMAN! can manage, use:
sdk listThis command displays a complete list of “candidates” (as SDKMAN! calls available SDKs), including descriptions and official websites.
Managing Java Versions
To list all available Java versions:
sdk list javaThis command shows a detailed table with information about different vendors (Oracle, OpenJDK, Amazon Corretto, Azul Zulu, etc.), available versions, and installation status.
To install a specific version of Java:
sdk install java 17.0.1-openSDKMAN! will ask if you want to set this version as default. If you answer “yes,” all new terminal sessions will use this version automatically.
Switching Between Versions
To temporarily switch to a specific version for the current session:
sdk use java 17.0.1-openTo set a version as the permanent default:
sdk default java 17.0.1-openTo check which version is currently active:
java -versionRemoving Versions
To remove a version you no longer need:
sdk uninstall java 17.0.1-openTips and Best Practices
Checking Installed Versions
To see which Java versions are installed on your system:
sdk list java | grep installedUpgrading SDKMAN!
To keep SDKMAN! up to date:
sdk selfupdateCleaning Up Old Versions
Periodically remove older versions you no longer use to save disk space:
sdk selfupdateSDKMAN! makes managing Java environments effortless. Whether you’re working on legacy systems or the latest frameworks, this tool will save you time and headaches.
Reference:
https://sdkman.io/
Thank you for reading!




