After installing java 11 on my system, runtime continues to be 1.8
Versions of java installed:
JAVA_HOME env variable value: C:\Program Files\Java\jdk-11.0.3
From command prompt running java -version
command, expecting to see java 11 info but instead I see java 8.
Changing environment variable value does not change the results, rebooting doesn't seem to be doing anything.
C:\Users\user>java -version
java version "1.8.0_211"
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) Client VM (build 25.211-b12, mixed mode)
expected is that java 11 runtime info is displayed
This just happened to me yesterday. Followed instructions to the letter, and still resulted in a different Java version (1.8.0) instead of the expected (11.0.5) for my downloaded version of JDK11. Funny enough, CMD prompt returned the correct Java version (11.0.5) for the 'javac -version' command, but not for the regular 'java -version' command. I was even told to try uninstalling the existing Java load by my IT expert, as he couldn't think of anything else to try... (I did not end up removing Java)
Turns out he did help me though, perhaps accidentally, but only realized this in hindsight. He told me to try moving the path variable
%JAVA_HOME%\bin
up to the very top of the displayed list of path variables found within the [Edit environment variable] window, for the PATH System Variable option. This did not work immediately, so we figured it had no effect. But I believe this failed because it turns out I had made an oversight when typing the variable in the first place. I had written the word "home" using small caps, instead of large caps. Once I realized my mistake and fixed it to show "HOME" in large caps, my CMD prompt returned the correct java -version of (11.0.5), which matched the javac -version command result.
Please note:
I then tried moving the %JAVA_HOME%\bin variable back to the bottom of the list, where it was originally created, and the java -version command no longer displayed v.11.0.5, but returned the original answer of v.1.8.0. So, I played around a bit and found that this variable needs to be ABOVE the following variable within the existing PATH window:
C:\Program Files (x86)\Common Files\Oracle\Java\javapath
Hope this helps others as it helped me!