SDKMAN! is a software development toolkit manager, a version manager similar to nvm for Node.js environments,
and rbenv for Ruby environments. This tool allows developers to manage parallel versions of different Software
Development Kits on most Unix-based systems (such as Linux, macOS, and Cygwin). It supports multiple versions and types
of SDKs, including Groovy, Scala, Gradle, Java, and of course, KOTLIN
Installing SDKMAN! is relatively straightforward using a terminal. While SDKMAN! is not directly available via brew or
other package managers, its own one-liner bash script will achieve the same purpose.
Note: No guarantees that below instructions are still up-to-date. Please refer to the official SDKMAN! website.
-
Open your terminal and enter:
curl -s "https://get.sdkman.io" | bash
-
To ensure that the installation was successful, open a new terminal or enter the following command in the current terminal:
source "$HOME/.sdkman/bin/sdkman-init.sh"
Sdkman init will also be automatically sourced by me zshrc file.
-
Then check SDKMAN! version by executing:
sdk version
If the installation went well, this should display the installed version of SDKMAN!.
Note: No guarantees that below instructions are still up-to-date. Please refer to the official SDKMAN! website.
Using SDKMAN!, you can easily manage different versions of an SDK. Here are a few common operations:
To install Java, use the install or i command followed by the software you want to install. For example, to install
Java 17:
sdk install java 17.0.7-jbr # jbr is the JetBrains RuntimeYou can also view all versions available for install by entering:
sdk list javaThis will display all the versions available to install as well as indicate the current and default versions in use.
To switch between available versions of an SDK, use the use command followed by the SDK and the version you want to
switch to. For example, to use Java 11:
sdk use java 11.0.14.1-jbr # jbr is the JetBrains RuntimeTo make a specific version the default version (which will be used in all new shells), you can use the default
command. For example, to set Java 11 as the default:
sdk default java 11.0.14.1-jbr # jbr is the JetBrains RuntimeIf you need to see the current version you're using for a specific SDK, you can use the current command. Specifically
for Java, use:
sdk current javaThis will display the currently active Java version.