Reputation: 1724
I got a windows machine and was able to install jdk 11.0.2 and set it up in my enviornment variables , my JAVA_HOME
environment looks as the following: C:\Program Files (x86)\Java\jdk-11.0.2\
but when I do java--version I get:
java version "1.8.0_192"
Java(TM) SE Runtime Environment (build 1.8.0_192-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.192-b12, mixed mode)
My System path is also point on java 11.0.2
C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH
\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files\Docker\Docker\resources\bin;C:
\ProgramData\DockerDesktop\version-bin;C:\Program Files (x86)\Java\jdk-11.0.2\bin;C:\Dev\Tomcat 8.5\Tomcat 8.5\bin;C:\Users\nxh113\tools\google-cloud-sdk\bin;C:\Users\nxh113\AppData\Lo
cal\Microsoft\WindowsApps;C:\Users\nxh113\AppData\Local\JetBrains\IntelliJ IDEA Community Edition 2020.1\bin;;C:\Users\nxh113\AppData\Roaming\npm;C:\Program Files (x86)\Java\jdk-11.0.2
;C:\Program Files (x86)\apache-maven-3.6.3\bin;C:\Users\nxh113\AppData\Local\Programs\Microsoft VS Code\bin;C:\Dev\Tomcat 8.5\Tomcat 8.5\bin;C:\ProgramData\chocoportable\bin;C:\Users\n
xh113\tools\google-cloud-sdk\bin;
Any ideas what can it be?
Upvotes: 2
Views: 2280
Reputation: 10003
another thing you might try is a batch file with:
jdk="C:\Program Files\Java\jdk-13.0.2"
javapath="C:\Program Files (x86)\Common Files\Oracle\Java\javapath"
mklink %javapath%\java.exe" "%jdk%\bin\java.exe"
mklink %javapath%\javaw.exe" "%jdk%\bin\javaw.exe"
mklink %javapath%\javaws.exe" "%jdk%\bin\javaws.exe"
Upvotes: 0
Reputation: 4937
The PATH variable mentioned above contains two entries for Java -
An older version of Java might be present in the first entry (C:\Program Files (x86)\Common Files\Oracle\Java\javapath). That is why, the java command is pointing to the older version.
The problem can be fixed by removing the old entry from the PATH variable.
Note:
Change to PATH variable will take effect in the cmd window opened after the change only. The cmd window that was already opened before PATH variable was changed will still use the old PATH only.
Upvotes: 3