Search code examples
antclasspathjava-home

Why does ANT tell me that JAVA_HOME is wrong when it is not?


I get the error:

C:\dev\ws\springapp\build.xml:81: Unable to find a javac compiler; com.sun.tools.javac.Main is not on the classpath. Perhaps JAVA_HOME does not point to the JDK. It is currently set to "C:\Program Files\Java\jre6"

But I have clearly set my JAVA_HOME to be C:\Program Files\Java\jdk1.6.0_14

Where is ANT getting this value?


Solution

  • When you say you have "clearly set" JAVA_HOME to "C:\Program Files\Java\jdk1.6.0_14" - is that what you see when you run "set" from the command line? I believe Ant will guess at a value for JAVA_HOME if one isn't set at all... is it possible that you've set JAVAHOME instead of JAVA_HOME?

    If it's nothing like that, I suggest you edit the ant.bat batch file (and whatever it calls - I can't remember whether it's convoluted or not offhand) to print out JAVA_HOME at the start and at various other interesting places.