1

Given

  • Multiple JDKs intalled in my Windows machine.. say JDK X, JDK Y,.. etc
  • Environment variables JAVA_HOME & PATH are pointing to JDK X.

Action

  • java -version at cmd, it printed JDK Y at console.

Expectation

  • want java -version to print JDK X

What am I missing, so that it should print JDK X ?

enter image description here

12
  • Check if JAVA_HOME & PATH are pointing to correct location of JDK X. Commented Mar 2, 2020 at 14:18
  • @kann Yes they are. Double checked this. Also, a mismatch here, i believe, would not had let me recognize java command at cmd Commented Mar 2, 2020 at 14:20
  • Try where java on the command line to see which executable it picks. I think some common installs put a java.exe in C:\Windows\System32 for some reason ... Commented Mar 2, 2020 at 15:18
  • @JoachimSauer It returned me two location 1)C:\Program Files (x86)\Common Files\Oracle\Java\javapath 2) exe at Java Home path location Commented Mar 2, 2020 at 15:24
  • @JoachimSauer location C:\Program Files (x86)\Common Files\Oracle\Java\javapath has 3 exe in it java, javaw, javaws Commented Mar 2, 2020 at 15:25

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.