I am programming through java 1.6 u_17, but i have JRE version 6 and JRE version 7 installed, so how to run my compiled program from JDK 1.6 to run through the JRE 6 only?<
Background
I'm using Windows 8.1 and I have both JDK6 and JDK8 installed. For development purpose, I needed to get java version "1.6.0_45"
over the command java -version
and javac 1.6.0_45
over javac -version
. The second command was working as expected after setting JAVA_HOME
as Home folder of JDK6 and adding %JAVA_HOME/bin%
in Path
. However the first command was still returning java version "1.8.0_71"
Troubleshooting
I could find the an entry in the Path
environment variable which points to C:\ProgramData\Oracle\Java
. This folder actually contains short cut to java.exe of JDK8.
Proper solution: Uninstall JDK 8
Workaround:Edit the short cut file so that it points towards java.exe inside %JAVA_HOME%\bin
(Please replace the variable with actual folder)