The issue is occuring most probably because you have a JRE in your PATH
, before your JDK. This usually happens when we add JDK in the PATH
and do not remove previously added JREs. Thus when you do java
it points to the JRE and when you do javac
it points to the other version/JDK (since the JRE does not have a javac
in it)
If you don’t have any JREs in your path, then you can copy your %JAVA_HOME%
and paste it first in your path variable (make sure its before the system32
path).
A possible reason for why this works is explained in this answer:
JRE also puts a
java.exe
toc:\Windows\System32
, that’s how first command is resolved. Second command is resolved by theC:\Program Files\Java\jdk1.7.0_02\bin
entry in yourPATH
variable.
If (and when) you are developing from the command prompt, you have to adjust thePATH
variable so thatC:\Program Files\Java\jdk1.7.0_02\bin
is beforec:\Windows\System32
.