Manage Java versions with SDKMan

The SDKMan project makes it easy to manage different versions of Java and related languages, including Groovy, Scala, Kotlin, and more.
No readers like this yet.

Java is more than just a programming language: It's also a runtime.

Applications written in Java are compiled to Java bytecode then interpreted by a Java Virtual Machine (JVM), which is why you can write Java on one platform and have it run on all other platforms.

A challenge can arise, however, when a programming language and an application develop at different rates. It's possible for Java (the language) to increment its version number at the same time your favorite application continues to use an older version, at least for a while.

If you have two must-have applications, each of which uses a different version of Java, you may want to install both an old version and a new version of Java on the same system. If you're a Java developer, this is particularly common, because you might contribute code to several projects, each of which requires a different version of Java.

The SDKMan project makes it easy to manage different versions of Java and related languages, including Groovy, Scala, Kotlin, and more.

SDKMan is like a package manager just for versions of Java.

Install SDKMan

SDKMan requires these commands to be present on your system:

  • zip
  • unzip
  • curl
  • sed

On Linux, you can install these using your package manager. On Fedora, CentOS Stream, Mageia, and similar:

$ sudo dnf install zip unzip curl sed

On Debian-based distributions, use apt instead of dnf. On macOS, use MacPorts or Homebrew. On Windows, you can use SDKMan through Cygwin or WSL.

Once you've satisfied those requirements, download the SDKMan install script:

$ curl "" --output

Take a look at the script to see what it does, and then make it executable and run it:

$ chmod +x
$ ./


When the installation has finished, open a new terminal, or run the following in the existing one:

$ source ~/.sdkman/bin/

Confirm that it's installed:

$ sdk version

Install Java with SDKMan

Now when you want to install a version of Java, you can do it using SDKMan.

First, list the candidates for Java available:

$ sdk list java
Available Java Versions for Linux 64bit
Vendor   | Version      | Dist | Identifier
Gluon    | | gln  |
         | | gln  |
GraalVM  | | grl  |
         | 21.3.1.r17   | grl  | 21.3.1.r17-grl
         | 20.3.5.r11   | grl  | 20.3.5.r11-grl
         | 19.3.6.r11   | grl  | 19.3.6.r11-grl | 19.ea.10     | open | 19.ea.10-open
         | 18           | open | 18-open
         | 17.0.2       | open | 17.0.2-open
         | 11.0.12      | open | 11.0.12-open
         | 8.0.302      | open | 8.0.302-open

This provides a list of different Java distributions available across several popular vendors, including Gluon, GraalVM, OpenJDK from, and many others.

You can install a specific version of Java using the value in the Identifier column:

$ sdk install java 11.0.12-open

The sdk command uses tabbed completion, so you don't need to view a list. Instead you can type sdk install java 11 and then press Tab a few times to get the options.

Alternately, you can just install the default latest version:

$ sdk install java

Set your current version of Java

Set the version of Java for a terminal session with the use subcommand:

$ sdk use java 17.0.2-open

To set a version as default, use the default subcommand:

$ sdk default java 17.0.2-open

Get the current version in effect using the current subcommand:

$ sdk current java
Using java version 17.0.2-open

Removing Java with SDKMan

You can remove an installed version of Java using the uninstall subcommand:

$ sdk uninstall java 11.0.12-open

More SDKMan

You can do more customization with SDKMan, including updating and upgrading Java versions and creating project-based environments. It's a useful command for any developer or user who wants the ability to switch between versions of Java quickly and easily.

If you love Java, or use Java, give SDKMan a try. It makes Java easier than ever!

Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.


Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.