Ant build not working: unable to find a javac compiler

Quick work around for the same is

Copy C:\Program Files\Java\jdk1.7.0_03\lib\tools.jar to C:\Program Files\Java\jre7\lib\

This exception is coming because JAVA_HOME is being set as C:\Program Files\Java\jre7 and Ant is not able to find tools.jar in it.


For eclipse

  • Right Click build.xml ---> Build path ---> configure buildpath ---> select libraries tab
  • click "Add library" ---> double click on [jre system library ] ---> environments ---> installed jres ---> Add ---> standard vm
  • click on directory ---> Browse upto jdk [C:\Program Files\Java\jdk1.7.0_01]
  • finish
  • change the selection jre to jdk ---> click ok