Why does java -version return an old version?

Set the environment variable JAVA_HOME pointing to the directory where you have jdk 1.6.0

set JAVA_HOME=your_path_to_jdk1.6
set PATH=%JAVA_HOME%/bin;.;..;%PATH%

That's from a command window. Also you can do it from "My PC > Properties > Advanced > Environment variables"


Go to the system32 directory C:\Windows\System32 and delete following 3 files

  • java.exe
  • javaw.exe
  • javaws.exe

Now create a JAVA_HOME environment variable with value={root path of your jdk installation} and add the path till bin folder of your jdk in the PATH environment variable.

Open a fresh command prompt and run java -version to confirm the change

Tags:

Java