Java 101Manage Your JVM Environment with SDKMAN

time to read 2 min | 394 words

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. Formerly known as GVM the Groovy enVironment Manager, it was inspired by the very useful RVM and rbenv tools, used at large by the Ruby community.

Install Software Development Kits for the JVM such as Java, Groovy, Scala, Kotlin and Ceylon. Activator, Ant, Gradle, Grails, Maven, SBT, Spring Boot, Vert.x and many others also supported.

Installing

Installing SDKMAN! on UNIX-like platforms is as easy as ever. SDKMAN! installs smoothly on Mac OSX, Linux, Cygwin, Solaris and FreeBSD. We also support Bash and ZSH shells. Simply open a new terminal and enter:

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

Follow the instructions on-screen to complete installation. Next, open a new terminal or enter:

$ source "$HOME/.sdkman/bin/sdkman-init.sh"

Lastly, run the following code snippet to ensure that installation succeeded:

$ sdk version

If all went well, the version should be displayed. Something like:

  sdkman 5.0.0+51

Beta Channel

For the more adventurous among us, they have a beta channel. All new CLI features will first be rolled out to this group of users for trial purposes. Beta versions can be considered stable for the most part, but might occasionally break. To join the beta program, simply update the the ~/.sdkman/etc/config file as follows:

sdkman_beta_channel=true

Next, open a new terminal and perform a forced update with:

$ sdk selfupdate force

To leave the beta channel, simply set the above config back to false and follow the same procedure.

Installing an SDK

Latest Stable

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

$ sdk install java

You will see something like the following output:

Downloading: java 8u111

In progress...

######################################################################## 100.0%

Installing: java 8u111
Done installing!

Now you will be prompted if you want this version to be set as default.

Do you want java 8u111 to be set as default? (Y/n):

Answering yes (or hitting enter) will ensure that all subsequent shells opened will have this version of the SDK in use by default.

Setting java 8u111 as default.

Specific Version

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

$ sdk install springboot 1.5.2

All subsequent steps same as above.