You probably have a java.exe in the C:\Windows\System32 directory. That directory is already in the PATH by default on Windows.
The java.exe in C:\Windows\System32 looks in the Windows registry to see which JRE it should use. It looks at the key \\HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\CurrentVersion (you can find it with regedit).
The same does not work with javac.exe - you have to put the directory that contains javac.exe in the PATH yourself.
The path variable does not contain a link to a jre.I have pasted the path variable's links.I did by right clicking and going on My Computer-->Properties-->System Variables--->path, then I copied the variable values.If I do the same and copy and past the path values again