Is there a way to change JDK version easily in cmd? like the version on mac. Change Default JDK on Mac.
Create a folder (in my case it is in C:\devenv) and create a batch file and name it after the version (jdk8.bat, jdk9.bat, jdk10.bat, jdk11.bat etc..) then add this commands. You just need to change the set JAVA_HOME to the location of the jdk version. Add the location of the batch files (C:devenv) to the path on the environment variables
@echo off
set JAVA_HOME=C:\Program Files\Java\jdk-11.0.9
set PATH=%JAVA_HOME%\bin;%PATH%
@echo Display Java Version
java -version
You can run it on cmd by just typing the batch name (e.g jdk11)