Blog

EN
SDKMAN - Java version management

SDKMAN - Java version management

3 min read

One of the main drawbacks when working with Java and its ecosystem is managing multiple versions of the JDK. You may find yourself using Java 8 in one project and Java 17 in another. SDKMAN is a tool that helps us with this, allowing us to manage multiple versions of Java easily, quickly, and efficiently.

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

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

Share this article on

Avatar byandrev

Andres Parra

Software Engineer

I'm Andres Parra, Software Engineer passionate about developing scalable and innovative technological solutions. I specialize in building modern web applications, mastering a versatile stack that includes JavaScript, TypeScript, Python, and Java, along with frameworks like React, Next.js, and Spring Boot. I'm also interested in the latest technologies and tools for development.