Response based on comments.
java.exe installed in the %SystemRoot%\system32 directory, and this java launches a version of Java based on your registry. If you want to override this version of Java, you need to make sure not only that it is in your PATH , but should appear in front of your %SystemRoot%\system32 otherwise only additional commands, such as javac or jar , will use the version you expect . (Since they are not in System32 )
source share