I have recently checked on my Java version. I ran the command java -version and I found out that I was using java version 1.7.0_09. But when I tried to
set JAVA_HOME="your jdk path"
set PATH=%JAVA_HOME%\bin;%PATH%.
Additionally if it does not work that means you have set the PATH for multiple java versions, include only the latest one and remove all from PATH variables.