How to manage different Java versions using the Jabba tool

What is Jabba Java?

Jabba is a Java version manager, that allows you to manage Java versions in your environment.

Without Jabba, If you want to change the current version to the new version, you have to lot of steps such as installation, configuring environment variables, and a time-consuming process.

With Jabba, You can easily change Java versions very quickly.

It is written in Golang and supports Windows, Linux, Ubuntu, and MacOS

It is similar to NVM for NodeJS and RVM for Ruby.

How to Install Jabba

Jabba is a cross-platform Java version manager, that supports all the platforms

  • How to install Jabba in Windows

    • Open Powershell terminal
    • Type below command in the terminal
    [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
    Invoke-Expression (
      Invoke-WebRequest https://github.com/shyiko/jabba/raw/master/install.ps1 -UseBasicParsing
    ).Content
    
  • To install on Linux Run the below command

curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash && . ~/.jabba/jabba.sh

How to set the default Java version using Jabba Manager?

You can do it in two ways

  • using the Jabba configuration file jabbarc file is a configuration file that can be placed globally or local project directory. It contains .jabbarc file in your Java project, add
1.11.0

You can specify the different versions for different projects.

  • using the command line
jabba alias default 1.11.0
jabba alias default <version> --global

--global option allows setting the global default Java version, that applies to all projects.

How to find the Java 12 version

First, Checkwill

jabba ls-remote | grep openjdk | grep 11

List all available versions

This command shows a list of supported versions in a Jabba repository

jabba ls-remote
  • List installed versions This command shows a list of available installed versions on your machine.
jabba ls
  • install Java version It installs the Java version into your machine. still new version is used until the use option used.
jabba uninstall versions
  • version aliases you can create an alias for installed Java versions. this alias name can be referred to while changing from one version to another version
jabba alias java11 11.0.2
  • migrate one version to another

Jabba use option allows to change and set the new version as default.

jabba use 12.0.1

To migrate using the alias

jabba use java11

java11 is an alias for 11.0.2 version created using command jabba alias java11 11.0.2

  • Uninstall Java versions

specify the version along with the uninstall option.

Jabba uninstall <versions>
  • Upgrade the Jabba command to the latest version Sometimes, the jabba tool version needs to upgrade latest. selfupdate option used.
jabba selfupdate

Feature

  • Installation of specific Java version
  • Switching Java versions from the command line
  • Set default Java version @[iat sam e]