Some time back, I wrote the article Java Lambda Expression Explained with Example, but it was easy for me to explore Java 8 because I was using it in my project and allowed to install it. But in my current project, we are still using Java 8, and now, I want to upgrade and learn Java 11, but unfortunately, I cannot install it.

And this happens a lot with Java developers. Sometimes, you want to learn and explore the latest version of Java, but you cannot install it on your machine because you and your team are working on an older version, e.g. Java 8, and you don’t want to accidentally break your project.

Or, suppose you are working on multiple projects, some of which use Java 8 and some of which are new projects using Java 11. So, in order to work on both of these projects, you will need to install multiple versions of the JDK on your machine and be able to switch between them.

What if there is a way to install multiple versions of Java and turn different versions on and off, depending on your needs.

Well, there is a tool called SDKMan which allows us to do just that. According to their website:

SDKMan! is a tool for managing parallel versions of multiple S oftware Development Kits on most Unix-based systems. It provides a convenient Command Line Interface (CLI) and API for installing, switching, removing, and listing Candidates.

Some points about SDKMan are as follows:

  1. SDKMan is free to use and is developed by the open-source community.
  2. SDKMan is written in bash and only requires curl and zip/unzip programs to be present on your system.
  3. We do not need to worry about setting the _HOME and PATH environment variables because SDKMan handles them automatically.

Installing SDKMan

SDKMan can run on any UNIX-based platforms such as Mac OSX, Linux, Cygwin, Solaris, and FreeBSD, and we can install it using the following commands:

$ curl -s "" | bash

$ source “$HOME/.sdkman/bin/”

We can verify the installation using `sdk version` and `sdk help` commands, which will give us complete help with the usage of the `sdk `command.

> Because SDKMan is written in [bash]( and only requires [curl]( and [zip/unzip]( to be present on your system, you can install SDKMan on Windows as well either by first installing [Cygwin]( or [Git Bash for Windows]( environment and then running the above commands.

#java #jvm #java 9 #jdk #java 11 #java 10 #jdk 11 #versions

How to Install Multiple Versions of Java on the Same Machine
1.45 GEEK