-2

In environment variables I have set the below things:

JAVA_VERSION: C:\Program Files\Java\jdk1.7.0_67;

And added %JAVA_HOME%\bin to the path.

When I run java -version in command prompt it is showing 1.8.0_40, and not 1.7.0_67. Why is that?

skaffman
  • 398,947
  • 96
  • 818
  • 769
Lakshmi
  • 175
  • 1
  • 4
  • 16
  • 1
    Why you need this `JAVA_VERSION` environment variable? Just update it to 1.8.0_40 in the same place where you updated the `PATH` variable. – Tagir Valeev May 05 '15 at 05:12
  • check your `C:\Windows\System32` there is `java.exe` there and it's version is `1.8` – Lrrr May 05 '15 at 05:15
  • You can use the `where` command in the command prompt to find out where exactly Windows is looking for the java command e.g. "where java". – Mike Rombout May 05 '15 at 05:16
  • sorry for typo. JAVA_HOME: C:\Program Files\Java\jdk1.7.0_67; .I tried Path :C:\Program Files\Java\jdk1.7.0_67\bin; like this, but showing java -version as 8 – Lakshmi May 05 '15 at 05:17
  • Getting C:\Windows\System32\java.exe C:\Program Files\Java\jdk1.7.0_67\bin\java.exe for "where java" command. how to remove the first one from system , Is it like manually possible to delete. – Lakshmi May 05 '15 at 05:19

2 Answers2

0

Please check in cmd for command :

echo %JAVA_HOME%
echo %PATH%

If JAVA_HOME is not set then set it

set JAVA_HOME="<PATH to JAVA_HOME>"
set PATH=%PATH%;<PATH TO JAVA_HOME/bin>

Please note that this change is temporary and you have to set it again in every case when you start cmd

For permanently adding JAVA_HOME and Path, please see https://www.java.com/en/download/help/path.xml

user811602
  • 1,314
  • 2
  • 17
  • 47
0

run the command

 echo %PATH%
 echo %JAVA_HOME%
 echo %JRE_HOME%

Check java 8 path is include in the above path.If not included, Include the java 8 path in that environment variable.

Mohan Raj
  • 1,104
  • 9
  • 17