Table of contents:

  1. What is SDKMAN?
  2. Installation
  3. Usage
  4. Manage Java Version
  5. Connclusion

What is SDKMAN?

SDKMAN! is a versatile development tool designed specifically for users of GNU/Linux and MacOS. With SDKMAN!, you can effortlessly install and oversee a variety of software components such as Java, Scala, Groovy, Maven, and numerous other tools and libraries that are part of the JVM ecosystem.

Installation

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

                                -+syyyyyyys:
                            `/yho:`       -yd.
                         `/yh/`             +m.
                       .oho.                 hy                          .`
                     .sh/`                   :N`                `-/o`  `+dyyo:.
                   .yh:`                     `M-          `-/osysoym  :hs` `-+sys:      hhyssssssssy+
                 .sh:`                       `N:          ms/-``  yy.yh-      -hy.    `.N-````````+N.
               `od/`                         `N-       -/oM-      ddd+`     `sd:     hNNm        -N:
              :do`                           .M.       dMMM-     `ms.      /d+`     `NMMs       `do
            .yy-                             :N`    ```mMMM.      -      -hy.       /MMM:       yh
          `+d+`           `:/oo/`       `-/osyh/ossssssdNMM`           .sh:         yMMN`      /m.
         -dh-           :ymNMMMMy  `-/shmNm-`:N/-.``   `.sN            /N-         `NMMy      .m/
       `oNs`          -hysosmMMMMydmNmds+-.:ohm           :             sd`        :MMM/      yy
      .hN+           /d:    -MMMmhs/-.`   .MMMh   .ss+-                 `yy`       sMMN`     :N.
     :mN/           `N/     `o/-`         :MMMo   +MMMN-         .`      `ds       mMMh      do
    /NN/            `N+....--:/+oooosooo+:sMMM:   hMMMM:        `my       .m+     -MMM+     :N.
   /NMo              -+ooooo+/:-....`...:+hNMN.  `NMMMd`        .MM/       -m:    oMMN.     hs
  -NMd`                                    :mm   -MMMm- .s/     -MMm.       /m-   mMMd     -N.
 `mMM/                                      .-   /MMh. -dMo     -MMMy        od. .MMMs..---yh
 +MMM.                                           sNo`.sNMM+     :MMMM/        sh`+MMMNmNm+++-
 mMMM-                                           /--ohmMMM+     :MMMMm.       `hyymmmdddo
 MMMMh.                  ````                  `-+yy/`yMMM/     :MMMMMy       -sm:.``..-:-.`
 dMMMMmo-.``````..-:/osyhddddho.           `+shdh+.   hMMM:     :MmMMMM/   ./yy/` `:sys+/+sh/
 .dMMMMMMmdddddmmNMMMNNNNNMMMMMs           sNdo-      dMMM-  `-/yd/MMMMm-:sy+.   :hs-      /N`
  `/ymNNNNNNNmmdys+/::----/dMMm:          +m-         mMMM+ohmo/.` sMMMMdo-    .om:       `sh
     `.-----+/.`       `.-+hh/`         `od.          NMMNmds/     `mmy:`     +mMy      `:yy.
           /moyso+//+ossso:.           .yy`          `dy+:`         ..       :MMMN+---/oys:
         /+m:  `.-:::-`               /d+                                    +MMMMMMMNh:`
        +MN/                        -yh.                                     `+hddhy+.
       /MM+                       .sh:
      :NMo                      -sh/
     -NMs                    `/yy:
    .NMy                  `:sh+.
   `mMm`               ./yds-
  `dMMMmyo:-.````.-:oymNy:`
  +NMMMMMMMMMMMMMMMMms:`
    -+shmNMMMNmdy+:`


                                                                 Now attempting installation...


Looking for a previous installation of SDKMAN...
SDKMAN found.

======================================================================================================
 You already have SDKMAN installed.
 SDKMAN was found at:

    /home/coffeina/.sdkman

 Please consider running the following if you need to upgrade.

    $ sdk selfupdate force

======================================================================================================

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

Usage

Commands to manage candidates (SDKs and other tools):

  • install or i: install a candidate version
  • uninstall or rm: uninstall a candidate version
  • list or ls: list available candidate versions
  • use or u: use a candidate version in current shell
  • default or d: set the default candidate version for every shell
  • current c: display current candidate version
  • upgrade or ug: upgrade outdated candidate version

Utility commands:

  • version or v: display the current version of sdk
  • broadcast or b: display the last broadcast message
  • help or h: show the sdk help message
  • offline: enable or disable offline mode
  • selfupdate: update the sdk
  • flush: flush sdk local state

Manage Java Version

sdk install java

================================================================================
Available Java Versions for Linux 64bit
================================================================================
 Vendor        | Use | Version      | Dist    | Status     | Identifier
--------------------------------------------------------------------------------
 Corretto      |     | 22           | amzn    |            | 22-amzn             
               |     | 21.0.2       | amzn    |            | 21.0.2-amzn         
               |     | 21.0.1       | amzn    |            | 21.0.1-amzn         
               |     | 17.0.10      | amzn    |            | 17.0.10-amzn        
               |     | 17.0.9       | amzn    |            | 17.0.9-amzn         
               |     | 11.0.22      | amzn    |            | 11.0.22-amzn        
               |     | 11.0.21      | amzn    |            | 11.0.21-amzn        
               |     | 8.0.402      | amzn    |            | 8.0.402-amzn        
               |     | 8.0.392      | amzn    |            | 8.0.392-amzn        
 Dragonwell    |     | 17.0.10      | albba   |            | 17.0.10-albba       
               |     | 17.0.9       | albba   |            | 17.0.9-albba        

All installed Java versions will be available in the folder:

ls $SDKMAN_DIR/candidates/java -l

To verify whether the installation was successful, you can confirm the current Java version. However, note that in Java 8 or earlier versions, the command java --version:

java --version
openjdk 21.0.2 2024-01-16 LTS
OpenJDK Runtime Environment Temurin-21.0.2+13 (build 21.0.2+13-LTS)
OpenJDK 64-Bit Server VM Temurin-21.0.2+13 (build 21.0.2+13-LTS, mixed mode, sharing)

Connclusion

SDKMAN! is a must-have for developers working with Java, Groovy, or any JVM-based language. Give it a try, and you won’t be disappointed.

My site is free of ads and trackers. Was this post helpful to you? Why not BuyMeACoffee


Reference:

  1. The Software Development Kit Manager
  2. Guide to SDKMAN!