I cannot run my Ant build.xml since I updated to java 1.7.0_52 (or there about). I have been running it for years through Eclipse locally on my Windows 7 laptop - but with t
Try adding JAVA_HOME\bin
to your env PATH
.
The real message is that Ant can't find com.sun.tools.javac.Main
.
Which, together with the fact that the latest "Sun" (Oracle) JDK is 1.7.0_13 (or maybe _14, but definitely not the "_52" that your install dir indicates), makes me think that you're not using a distribution that Ant recognizes. You can verify this by running jar tvf $JAVA_HOME/lib/tools.jar
, and looking for that class.
The Ant Manual talks about ways to work with different compilers. Since I've only used "Sun" compilers, I'm afraid that I can't give you any pointers.
Edit: you could also try setting fork="yes"
in your build file. This should run the compiler executable rather than trying to invoke the compiler class.
The solution
"Had to copy C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar to C:\Program Files\Java\jre6\lib\ext
" from here was great helpful and worked for me.
I was having the same message when running ANT through Eclipse.
What worked for me:
tools.jar
was wrong. It was pointing to an older version of Java;Sorry for the unearthing,
I had the same problem, my solution doesn't need any modification in environment variables, and works for a recent JDK where the tools.jar can't be found.
Just go in the small down-arrow next to the ant run button Then click "Configure external tools" Then in JRE tab Select a JDK installed on your computer, not a JRE, no problems if the selected JDK is not the same JDK/JRE as in your project.
It should be work now.
Add JAVA_HOME to Eclipse-Preferences-Java-Build Path-Classpath Variables.