Wednesday, May 9, 2007

Ant cannot compile java files

[javac] BUILD FAILED: [build file location here]
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


You get this err in Eclipse when trying to compile it with ANT

Its really cool to resolve this issue =)

Go to Window --> Preferences -->Ant-->Runtime-->Global Entries --> Add External Jars

Add the following Jar from your java home,

In my case its C:\Program Files\Java\jdk1.5.0_11\lib\tools.jar

yeppee..!!! and it all worked magically when I hit build again.. cool I love ant..!!!!

To Learn More go to: http://www.dynamicobjects.com/d2r/archives/002591.html


--Sonu

No comments: