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.
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.
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
Java/jre6
, but this complicates setup. Interesting that Oracle's installer supports by default different JDK subfolders (e.g. jdk1.6.0_37, jdk1.6.0_45) but only one JRE subfulder.
I have solved this by creating batch files for different Java versions.
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
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.
Try using sdkman
. Even though the installing on Windows is a bit 'tricky' but there are several options.
There was a big mess with different incompatible JDK and JRE from 90s when Java was created and still this problem exists. The main rule is when you type in console:
java -version
and
javac -version
the result should be the same then you sure both JRE and JDK (JSDK) are compatible, so when you compile you can rut it without any problems.
JAVA_HOME
and PATH
are essential for many console applications
and some GUI tools might use those variables as well but often is possible to alter default settings in GUI application instead of messing with environment variables. Also CLASSPATH
still sometimes are used as well, however better use ANT as compiler than javac directly.
You can install multiple JDK and JRE but each one should to have its own separate folder, the default should be usually ok.
Worth mentioning that every JDK have JRE included and it instal in separate folder and as separate APP in Windows Control Panel -> Applications to be more confusing, so basically developer will never have to download and install JRE. Do not use Java update application which might cause problems after update some apps might not work, just do it manually.