Search code examples
javajava-home

JAVA_HOME path issue


I am using Windows 10. My JAVA_HOME path is set to the location of Java 1.7 but on executing

java -version 

in cmd, it gives version as Java 1.8. Can anyone tell me why I am getting this issue and how to fix it?

EDIT: In response to some of the fixes suggested, my system variable PATH too has the path to 1.7.


Solution

  • In the System Variable PATH, the Java 7's path must be in the front, not at the end. Are you able to execute java -version from the Java 7's directory and seeing the version displayed to be correct?