How to Install Multiple Java Versions via SDKMAN on Ubuntu ..!

How to Install Multiple Java Versions via SDKMAN on Ubuntu ..!

Table of contents

No heading

No headings in the article.

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 also allows the developers to install JVM-based SDKs like Java, Groovy, Scala, Kotlin, and Ceylon. Maven, Gradle, SBT, Spring Boot, Vert.x, and many others are also supported. SDKMAN! is a free, lightweight, open-source utility written in Bash.

How to Install Multiple Java Version via SDKMAN on Ubuntu Using 10 Easy Steps

  1. Step 1: Update Your System

     $ sudo apt-get update
    
  2. Step 2: Install Prerequisites - Zip, Unzip

     $ sudo apt install zip
    
  3. Step 3: Install SDKMAN

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

  4. Step 4: Follow the on-screen instructions to complete the installation and verify.

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

  5. Step: Find Java Versions available.

     $ sdk list java
    

  6. Step 6: Install Java 19.0.2 Version

     $ sdk install java 19.0.2-open
    

  7. Step 7: Verify Installed Java Version

     $ java --version
    

  8. Step 8: Install Java 20.0.1 Version and default option give

    Yes / No (based on requirement) and Verify Currently Installed Java Versions.

$ sdk install java 20.0.1-open

$ sdk java list

  1. Step 9: Whenever need another Java version change default
$ sdk default java 20.0.1-open

  1. Step 10: If you need remove any Java version First change default version to another Java version then uninstall required Java version and verify also

     $ sdk uninstall java 20.0.1-open
    

     $ sdk java list
    

Reference

https://sdkman.io/