SDKMAN! Managing SDKs Was Never so Easy

DZone 's Guide to

SDKMAN! Managing SDKs Was Never so Easy

If you’re working on multiple Java projects, it is very common to switch between different Java versions.

· Integration Zone ·
Free Resource

If you’re working on multiple Java projects, it is very common to switch between different Java versions. I face this too often. We have a number of projects running in production that need a different Java version. Sometimes, we need to fix issues or to add a customer required feature in older projects. These older projects require Java version 6 or 7, while newer projects require Java 8 or 9. So, it is often required to switch between them during development.

There are many different ways to switch between Java versions, and most of them are dependent on different OS environments i.e. MacOS, Linux, Windows, etc. Below are some examples of how to do the switching.

For Ubuntu/Debian Linux:

$ sudo update-alternatives—config java

For Redhat/Fedora:

$ su 
$ /usr/sbin/alternatives—config java 
$ /usr/sbin/alternatives—config javac

For MacOS:

$ /usr/libexec/java_home-v

When you work in multiple OS environments, i.e work in a server machine (linux distro) or on a desktop/laptop (macOS/ubuntu/windows), it is a problem to remember all these commands. So, is there any easier way to solve this problem?

Here comes SDKMAN! The Software Development Kit Manager. SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing and listing Candidates.

  • SDKMAN! is for making life easier for developers. No more trawling download pages, extracting archives, messing with _HOME and PATH environment variables.
  • It is written in bash and only requires curl and zip/unzip to be present on your system.
  • It runs on any UNIX based platforms: Mac OSX, Linux, Cygwin, Solaris, and FreeBSD. A Powershell CLI version is available for Windows users.
  • It allows us to manage multiple versions of each candidate.


To install this amazing tool, simply open a new terminal and enter:

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

Follow the instructions on-screen to complete the installation.


It currently supports Java, Kotlin, Scala, Groovy, Maven, Ant, Gradle, Grails, sbt, Spark, Spring Boot, VisualVM and many more. To list all the available candidates:

$ sdk list

Install the latest stable version of your SDK of choice (say, Java JDK) by running the following command:

$ sdk install java

Need a specific version of an SDK? Simply qualify the version you require:

$ sdk install java9.0.4-oracle

Listing all available candidates for Java:

$ sdk list java

Available Java Versions
   + 9.0.4-oracle                                                                  
 > * 8.0.171-oracle                                                                
   + 7                                                                             

+ - local version
* - installed
> - currently in use

When having multiple versions installed, to see the current version in use, run:

$ sdk current java

To switch the Java version for the current terminal, run:

$ sdk use java 8.0.171-oracle

If you want to set a specific version as default for all terminals, run:

$ sdk default java 8.0.171-oracle

Now no matter what is your operating system is, you can easily switch between your SDK version running a common command.

For more detail about SDKMAN! go visit the official site.


I have shown how to manage different versions of Java using SDKMAN!. You can do similar for any supported SDKs. I must say, SDKMAN! is a must-have tool for all software developers to make life easier managing different SDK versions. Give it a try. You will love it.

cli, integration, java, linux, sdk manager plugin, sdkman, shell language, software developer kit manager, tutorial

Published at DZone with permission of Monzurul Haque Shimul . See the original article here.

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}