Just installed java 1.7 update 51 on a Windows 7 machine. AFAICT, when I compile a source, the system automatically uses the new java. But I try to run it, the system automatically tried to run it with an old java 1.6, and the newly compiled code won't run. How do I convince the machine to use only the 1.7 distribution?
Asked
Active
Viewed 107 times
0
-
4fix your paths ahd classpaths – OldProgrammer Feb 01 '14 at 18:43
-
2Uninstall the 1.6 runtime. – i_am_jorf Feb 01 '14 at 18:43
-
4Change your `PATH` and `JAVA_HOME` environment variables to point to the 1.7 installation if you want to keep the 1.6. – Philipp Gayret Feb 01 '14 at 18:45
-
Or set the target to 1.6 while compiling http://stackoverflow.com/questions/15492948/javac-source-and-target-options – zapl Feb 01 '14 at 18:49
-
I confirmed that there's no reason to keep the 1.6 (and I understand old java versions present security issues anyway) so I just uninstalled the 11.6 and now everything is fine. Thanks! – bob.sacamento Feb 01 '14 at 18:59
2 Answers
1
There is a difference between the JDK (java development kit with javac compiler), and the JRE (java runtime environment). Simply doing an additional JRE 7 installation will do. (This might have been asked during the installation of the JDK.)

Joop Eggen
- 107,315
- 7
- 83
- 138
1
Do you have java.exe in your System32 folder?
I suspect this might be your problem.
See this question I recently asked.
Java Windows7 System32 folder java.exe
I suggest you remove both JDKs, then you install them both without the
option to install a public JRE (be careful about this at installation time).
Also, make sure you understand/control what is in your PATH variable.
I also have both 6 and 7 on my machine, and
since I got rid of the public JREs I am fine.

Community
- 1
- 1

peter.petrov
- 38,363
- 16
- 94
- 159