SDKMan Migration Guide

To make it easier to manage your development environment, it is recommended that you migrate to using SDKMan, the Software Development Kit Manager. This document will walk through the steps needed to migrate your system to using it.

Verify Your Current Environment

  • It’s likely that you installed your existing JDK, Maven, Gradle and jEnv installations using brew, but verify that it is installed and up to date before you begin.

  • Verify the versions of Java that are installed and their install locations. This will be helpful for uninstallation. Execute jenv versions to see which are currently being used.

Uninstall Existing Tools using brew

If you used brew to install your tools, then removing them is easy:

brew uninstall jenv
brew uninstall gradle
brew uninstall maven

Depending on how you installed Java and which version(s) you have installed, the following could be slightly different.

For OpenJDK installations:

brew uninstall java

Or

brew uninstall openjdk@<major_version>

Example:

brew uninstall openjdk@17

If you installed any of the above from an installer or through some means other than brew, follow the uninstall instructions that accompanied the installation.

If all else fails, you can manually remove the installation from its location by force.

rm -rf <path_to_installation>

Update Your Shell Configuration

Remove the jEnv entries that were written to your shell configuration at installation. The entries should be similar to the following:

export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"

If you have any entries that add Java to your path, remove those, as well. For example:

export PATH="/opt/homebrew/opt/openjdk@21/bin:$PATH"

Install SDKMan and Tools

Execute the following to get started installing SDKMan:

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

Follow the instructions in the terminal output to source your shell configuration after installation.

Java

sdk install java

This will install Java 21 (currently 21.0.5-tem) and set it as default. To install Java 17, specify it by its identifier:

sdk install java 17.0.13-tem

You will be prompted whether you want this version to be the default during installation. To see which java versions are installed and available:

sdk list java

The current default version will be denoted with ` >>>` next to its version number. If you want to change which version of Java your system is using:

sdk default java <identifier>

Alternatively, if you just want to update which version of Java your current shell is using:

sdk use java <identifier>

There are many different JDKs that can be installed via SDKMan. For information about installing other versions, go to https://sdkman.io/.

Maven and Gradle

sdk install maven
sdk install gradle

The default installed versions should work fine, but if you have any issues, you can use the steps above to list other available versions and set as your default.