Search code examples
javacjava-7

How top set java 7 compiler at windows 7


I have installed java 7 on my machine.

java -version shows that:

java version "1.7.0_09"
Java(TM) SE Runtime Environment (build 1.7.0_09-b05)
Java HotSpot(TM) 64-Bit Server VM (build 23.5-b02, mixed mode)

javac -version showing

javac 1.6.0_10

When I am trying to build application using Ant it showing me error of "it is recommended that the compiler be upgraded"

How can I update path of javac to point java 7, my JAVA_HOME and PATH variable contain C:\Program Files\Java\jdk1.7.0_09 and C:\Program Files\Java\jdk1.7.0_09\bin respectively.


Solution

  • Try one of the following:

    1) Change the PATH. Set JAVA_HOME before the windows paths. This is because under the windows folder, there is a java.exe that redirects to the last installed jre.

    2) Regedit. The key HKEY_LOCAL_MACHINE->SOFTWARE->JAVASOFT->Java Runtime Environment contains the last installed version that the java.exe in the windows folder redirects to. If you change this to the version you want, everything should be ok.