byandrev's blog
  • #java

SDKMAN - Java version management

2 min read

What is SDKMAN?

SDKMAN is a version manager for Unix-based environments (Linux and macOS), and it can also be used on Windows with WSL. It allows you to easily install and switch between different versions of Java and other related tools in this ecosystem. It’s simple to use since it operates from the terminal, similar to how nvm works for Node.js users.

Installation

To install SDKMAN, you need to have the zip package installed to ensure the command works correctly.

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

After installation, reload some configuration data:

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

How to Install a Java Version

To install a specific version of Java, run the following command:

sdk list java

This will display a list of all available Java versions. Copy the Identifier of the version you want to install and then run:

List of available Java versions to install with SDKMAN
List of available Java versions to install with SDKMAN

sdk install java identifier

For example:

sdk install java 17-tem

Switching Between Java Versions

If you have multiple versions installed, you can easily switch between them:

sdk use java 11.0.20-tem

Viewing Installed Versions

To see all installed Java versions, use this command:

sdk list java