How to switch between Multiple JDKs (JAVA) on Windows

Manul Wickramanayaka
Test Automation Hub
3 min readJun 14, 2021

--

Switching between Multiple JDKs (JAVA) on Windows from the command line

As a Java programmer, we may work on various projects and tools like Jenkins on different Java versions, especially since the transition to the six-month release cycle.

The typical way is going to Environment variables and change the bin path according to the particular java version. You may find that this is repetitive work and we have to change back it to the default Java version manually every time we change it.

From time to time, I also have a piece of Java code that I want to try out on different Java versions on the command line without having to click through the menus of the Environment Variables window every time. So it is helpful to be able to quickly and easily change the Java version to be used for compiling code, launching applications or executing class files.

So let's see how to do it…

Installation of multiple Java versions

Installing several Java versions at the same time is incredibly easy in Windows. You can download and run the installer for each…

--

--