I normally still use Java 7 for all my coding projects (it\'s a company \"politics\" issue), but I installed Java 8 for one third-party project I am contributing to. Now, it see
Looks like you have to check where in your PATH is located your JAVA_HOME variable, the PATH is evaluated from left to right. A tip for you is to do all your Java system variables configuration at the beginning of your PATH.
PATH = %M2_HOME%\bin;%JAVA_HOME%\bin;C:\ProgramData\Oracle\Java\javapath;...
Probably that's why after doing this:
- java -version
you are getting this:
- java version "1.8.0_05"
because there are other areas in your PATH that are pointing to other java.exe, for example C:\Windows\System32 or C:\ProgramData\Oracle\Java\javapath etc.
Change registry key **HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion**
to point to 1.7
Copy java.exe,javaw.exe and javaws.exe
from your java 1.7 version to Windows\System32
folder
(Since the corresponding files of java 1.8 are already there, you might have to overwrite with admin permissions)
(OOps actually not required 3rd step )
Open a new cmd window and check
java -version
I had to make 2 changes for it to work:
Windows and Unix both find programs using their PATH
environment variable. You have an java.exe
in your Windows\System32
which is appearing before your "preferred" version of Java.
Change the PATH to be the one you need, or specify the full path when you need a different version.
When you install jdk8 it adds an entry like this
C:\ProgramData\Oracle\Java\javapath
to beginning of your PATH environment variable, removing this entry should resolve your problem.
You can select the JRE version from the command line with the -version: option.
> java -version:"1.7" MyClass
should select the 1.7 JRE if installed properly.
The list of the properly installed JRE is in the registry, see the key :
HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment (32bit)
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\JavaSoft\Java Runtime Environment (64bit)
You can set the "CurrentVersion" there if you want a different default version than the latest.
See http://docs.oracle.com/javase/7/docs/technotes/tools/windows/java.html#options
Don't modify your PATH to point to a particuliar JRE, let the special java.exe in Windows/system32 do the job.