Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How install multiple JDK on Windows?

Tags:

I want to install JDK 1.5 and 1.6 on XP, is it possible? how to do it

Also, I am using Eclipse how to setup using different JDK for different projects?

thanks.

like image 292
Eric Yung Avatar asked May 20 '09 08:05

Eric Yung


People also ask

Can I have multiple JDK installed on Windows?

You can install multiple JDK and JRE but each one should to have its own separate folder, the default should be usually ok.

Can I install multiple versions of JDK?

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.


4 Answers

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

like image 104
Manrico Corazzi Avatar answered Sep 23 '22 14:09

Manrico Corazzi


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 
like image 34
Osanda Deshan Avatar answered Sep 22 '22 14:09

Osanda Deshan


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.

like image 26
graham.reeds Avatar answered Sep 19 '22 14:09

graham.reeds


Try using sdkman. Even though the installing on Windows is a bit 'tricky' but there are several options.

https://sdkman.io/install

like image 32
ownerofglory Avatar answered Sep 19 '22 14:09

ownerofglory