How install multiple JDK on Windows?

You may install different JDKs easily: just specify different folders.

You can setup the installed JDKs in Eclipse Window/Preferences/Installed JREs

You can pick the JDK and Java version for every single project in Project/Properties/Java Compiler


Why? There is an option (can't remember where exactly - right-click on your project) that allows you to set the target JDK level. I use this when developing GWT applications.


I have solved this by creating batch files for different Java versions.

  1. I have installed the Java versions I need to have
  2. Whenever, I need to use Java I run the appropriate batch file and set the environment variables to work with that Java version.

Java 8.bat

@echo off
echo Setting JAVA_HOME
set JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121
echo setting PATH
set PATH=%JAVA_HOME%\bin;%PATH%
echo Display java version
java -version

Java 10.bat

@echo off
echo Setting JAVA_HOME
set JAVA_HOME=C:\Program Files\Java\jdk-10.0.2
echo setting PATH
set PATH=%JAVA_HOME%\bin;%PATH%
echo Display java version
java -version

Tags:

Java

Eclipse