Using sdkman
Manage software versions using sdkman
If you are developer and have installed Java or similar software, you must have gone through the pain of installation, configuring PATH, environment variables etc. And if you wish to use multiple versions of the same software, then that’s alone a different set of problem.
SDKMAN is a wonderful project which solves the problem very nicely at least for Java ecosystem related software. Below are the steps which shows how to use sdkman to install any supported sotware. I have taken example for Java here, but these steps are same for other SDK also.
Installation
$ curl -s "https://get.sdkman.io" | bash
Verify sdkman version
$ sdk version
==== BROADCAST =================================================================
* 2022-07-19: quarkus 2.10.3.Final available on SDKMAN! https://github.com/quarkusio/quarkus/releases/tag/2.10.3.Final
* 2022-07-18: grails 5.1.9 available on SDKMAN!
* 2022-07-14: grails 3.3.15 available on SDKMAN!
================================================================================
Check for available Java versions
$ sdk list java
================================================================================
Available Java Versions for Linux 64bit
================================================================================
Vendor | Use | Version | Dist | Status | Identifier
--------------------------------------------------------------------------------
Corretto | | 18.0.2 | amzn | | 18.0.2-amzn
| | 18.0.1 | amzn | | 18.0.1-amzn
| | 17.0.4 | amzn | | 17.0.4-amzn
| | 17.0.3.6.1 | amzn | | 17.0.3.6.1-amzn
| | 17.0.0.35.1 | amzn | | 17.0.0.35.1-amzn
| | 11.0.16 | amzn | | 11.0.16-amzn
| | 11.0.15.9.1 | amzn | | 11.0.15.9.1-amzn
| | 11.0.12.7.1 | amzn | | 11.0.12.7.1-amzn
| | 8.332.08.1 | amzn | | 8.332.08.1-amzn
Dragonwell | | 17.0.3 | albba | | 17.0.3-albba
| | 11.0.15 | albba | | 11.0.15-albba
| | 11.0.12.8 | albba | | 11.0.12.8-albba
| | 8.8.9 | albba | | 8.8.9-albba
| | 8.0.332 | albba | | 8.0.332-albba
Gluon | | 22.1.0.1.r17 | gln | | 22.1.0.1.r17-gln
| | 22.1.0.1.r11 | gln | | 22.1.0.1.r11-gln
This is not the complete list, but you can choose anyone of it and install.
Install Java using sdkman
$ sdk install java 20.ea.6-open
Verify installation
$ java -version
openjdk version "20-ea" 2023-03-21
OpenJDK Runtime Environment (build 20-ea+6-304)
OpenJDK 64-Bit Server VM (build 20-ea+6-304, mixed mode, sharing)
Switch between multiple installation of Java
One can install multiple version of Java (same apply for other software) and switch easily between them using one of the following ways:
Use default command.
$ sdk default java 20.ea.6-open
Use specific version in the current session only
$ sdk use java 20.ea.6-open
Activate a version while using using a directory
$ cd <target directory> $ sdk env init
A file
.sdkmanrc
gets created in the target directory. Set the valuejava=20.ea.6-open
and save. Then execute:$ sdk env
Check the current version using current
command
$ sdk current java
The similar steps can be done to install scala, sbt etc.
Further readings: 1. https://sdkman.io/
Share this post
Twitter
Google+
Facebook
Reddit
LinkedIn
StumbleUpon
Pinterest
Email