When a new stable version of macOS becomes available, there are times when I decide to perform a clean reinstall of my computer. After this process, it becomes necessary to reinstall all the essential tools for my work, which can be quite tedious.
It is in this context that SDKMAN comes into play as an extremely practical utility that goes far beyond the mere management of JDKs on your computer.
SDKMAN, short for “Software Development Kit Manager,” is an invaluable tool for Java developers who wish to effectively manage JDK (Java Development Kit) versions. It greatly simplifies the management of different JDK versions, providing straightforward control over your Java development environment.
The advantages of SDKMAN for JDK version management include:
Easy Installation: SDKMAN streamlines the JDK installation process by automating it. No more searching for downloads or dealing with tedious manual configurations and installations. With just a few simple commands, SDKMAN takes care of everything.
Version Management: With SDKMAN, you can install multiple JDK versions simultaneously on your system. This allows you to easily switch between different versions based on your project requirements.
Flexibility and Adaptability: SDKMAN offers a wide range of JDK versions, including both stable releases and the latest development versions. You can choose the version that best suits your project, considering specific features or compatibility requirements.
Simplified Updates: SDKMAN makes updating your JDK a breeze. The tool notifies you about new available versions and enables quick and hassle-free installations.
Cross-Platform Compatibility: Whether you’re working on macOS, Windows, or Linux, SDKMAN adapts to your environment. It ensures a consistent and seamless experience, regardless of the operating system you’re using.
In summary, SDKMAN is a powerful and essential tool for Java developers. It simplifies JDK version management, keeping you up-to-date with the latest features and preventing compatibility issues. Whether you’re a seasoned developer or just starting out, SDKMAN gives you full control over your Java development environment, allowing you to work efficiently and without hassle.
SDKMAN Installation
To take advantage of the benefits offered by SDKMAN, it is essential to install it correctly on your system. Here are the detailed instructions for installing SDKMAN on macOS, Windows, and Linux:
Installation on macOS and Linux:
Step 1: Open your terminal.
Step 2: Execute the following command to download the SDKMAN installation script:
Shell
Step 3: Wait for the script to be downloaded and installed.
Step 4: After installation:
Load a new terminal session
Or execute the following command to load SDKMAN into your current session:
Shell
Step 5: To verify if SDKMAN has been successfully installed, type the following command:
Shell
You should see:
Output
Installation on Windows:
On Windows, it’s necessary to have a Bash terminal. The easiest way is to install Windows Subsystem for Linux 2 (WSL2).
Once installed, proceed as if you were on macOS or Linux.
Congratulations! You have now installed SDKMAN on your system. You are ready to enjoy its powerful features for JDK version management.
Note
All SDK installations will now be done under your HOME directory that is in the ~/.sdkman on linux-friendly OS.
JDK Installation
Once you have successfully installed SDKMAN, you can proceed with the installation of a specific JDK using this tool.
Take a moment to think about it, and let’s explore some SDKMAN commands.
Candidate vs Version
As the name suggests, SDKMAN allows you to install SDKs, and Java is just one of the potential candidate’s.
So, first, you need to choose the SDK (candidate) to install.
Candidate
To see the list of available SDK/candidates, use the following command:
Shell
Note
Type q to exit the list.
You can see that there are many things you can install. Just to name a few:
Gradle
Groovy
Java
Maven
Micronaut
SBT
Scala
Spring Boot
Tomcat
VisualVM
Version
Now, let’s focus on the candidate we’re interested in: Java. Let’s see the versions that SDKMAN offers us.
To do that, let’s query SDKMAN:
Shell
Here is the list I obtained:
Output
Actual installation of the JDK
Place your bets … me, it’s done! As I am working on the build of Java code in native code at the moment, I choose GraalVM CE in version 20.0.2 and I select its identifier 20.0.2-graalce.
It’s your turn. To install it, I run the command:
Shell
Which gives me the output, the installation process
Output
Done! No, not yet … I need more JDKs for comparison. Moreover, this is why we installed this tool.
For my part, I install two others:
Shell
Shell
JDK Selection
Let’s now see how to select a specific version of Java.
Seasoned professional in the field of information technology, I bring over 20 years of experience from working within major corporate IT departments. My diverse expertise has played a pivotal role in a myriad of projects, marked by the implementation of innovative DevOps practices.