SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on Unix-based systems. It provides a convenient command-line interface for installing, switching between, and removing different versions of Java, Gradle, Maven, and other JVM-based development kits.

System requirements

SDKMAN! requires a Unix-like environment and is compatible with:

  • Linux distributions.
  • macOS.
  • Windows (via WSL or Git Bash).
  • Bash and ZSH shells.

Required components

  • curl or wget for downloads.
  • zip and unzip for package management.
  • sed and awk for text processing.
  • POSIX-compliant shell (bash or zsh).

Windows setup options

WSL Installation (Recommended):

  • Install Windows Subsystem for Linux.
  • Install required tools via package manager.
  • Follow standard Unix installation steps.

Git Bash Alternative:

  • Install Git Bash for Windows.
  • Add MinGW tools for Unix utilities.
  • Configure system PATH as needed.

Note: Native Windows installation is not supported. WSL provides the best experience for Windows users.

Installation

The installation process consists of downloading and executing the SDKMAN! installation script. Open a terminal and execute:

curl -s "https://get.sdkman.io" | bash

For systems where curl is not available, wget can be used as an alternative:

wget -qO- "https://get.sdkman.io" | bash

SDKMAN! installation

Afterward, open a new terminal or initialize SDKMAN! in the current shell:

source "$HOME/.sdkman/bin/sdkman-init.sh"

To verify the installation:

sdk version

Usage

  • sdk list: Display all available candidates (SDKs).
  • sdk list java: List available versions for Java.
  • sdk list maven: List available versions for Maven.
  • sdk current: Show current installed versions.
  • sdk current java: Show current installed versions of Java.
  • sdk install java: Install the latest stable version of Java.
  • sdk install java 21.0.7-zulu: Install a specific version of Java.
  • sdk install maven 3.9.9: Install the version 3.9.9 of Maven.
  • sdk uninstall java 24.0.1-graal: Remove an installed version of Java.

Install Java 21

Switch between versions

Switch the current terminal to a specific version:

sdk use java 21.0.7-zulu

Set the default version for all terminals:

sdk default java 21.0.7-zulu

Switch between versions

Advanced Features

Offline mode

Enable offline mode:

sdk offline enable

Auto-Answer mode

Skip confirmation prompts:

sdk install java 21.0.7-zulu -y

Update SDKMAN!

Keep the tool up to date:

sdk selfupdate
sdk update

Conclusion

SDKMAN! streamlines the management of multiple JVM development kits through an intuitive command-line interface. Its capabilities include:

  • Simple installation and version management.
  • Support for multiple JDK distributions.
  • Offline operation capabilities.
  • Automated updates and maintenance.

References