0

I faced with following problem on Windows.

I used java 7. Then I need to use java 6. I download jdk 6 and install it.

I set JAVA_HOME and PATH environment variables.

But after it I tryed to type java -version in cmd. I got answer - java -7.

I typed command where java and I got 2 strings:

first - in windows/sytem32 second - in Program Files

As I understood in windows/sytem32 windows stores public jre.

How can I correctly replace public JRE to 6 version at this case?


But I just remove java.exe and javaw.exe from windows/sytem32 folder and after it java -version returns java 6. But I affraid that this way is incorrect. What should I do at this situation?

2 Answers2

0

I would advice that you don't install public JRE at all.

See also here: Java Windows7 System32 folder java.exe

I think that's similar to your issues. I have both 6 and 7 coexisting
on my PC without any issues after I installed them without public JREs.

Community
  • 1
  • 1
peter.petrov
  • 38,363
  • 16
  • 94
  • 159
0

Follow below link to uninstall Java 7 cleanly:

How do I uninstall Java on my Windows computer?

And then install Java 6 as usual.

UPDATE:

Setting the PATH variable just provides you the access to javac and the other programs and tools in the JDK bin folder. The java.exe in \windows\system32\ is provided so that not everyone needs to set a PATH variable just to run a java program (from the command line) and selects a version (the last one installed it seems) of the installed java virtual machines (JVM) if there are more than one (publicly) installed.

Moreover, I tried to do keep install Java 7 on my machine and found out that installation of Java 7 silently deleted Java 6. On further digging into this aspect, I found on Oracle's website that:

The Java auto-update mechanism is designed to keep Java users up-to-date with the latest security fixes. To achieve this goal Windows users that rely on Java’s auto-update mechanism will have their JRE 6 replaced with JRE 7.

Which clearly means that it will replace older java.exe & javaw.exe with newer one. By doing this system ensures that applets will run on the latest and most secure version of the JRE software. Hence, this move is justified in case of JREs which is an end user software, but removing JDK 1.6 would by contrast be poor behaviour, because the JDK is a developer tool, and developers should know what they are doing.

Quote from http://mindprod.com/jgloss/javaexe.html#MULTIPLES

To complicate things further the java.exe in system32 is just a dummy. It looks in the registry and then decides which real java.exe to use. The last JVM installed gets to be the one used, even if it is older. To switch JVM s, you must normally reinstall the one you want.

Shishir Kumar
  • 7,981
  • 3
  • 29
  • 45