I am using windows 7 and had installed java under C:\Program Files (x86)
May be the space or the special chars in the path should have created problem with ant
Just copied the java folder from C:\Program Files (x86)\ to D: and set my JAVA_HOME to D:\java\jdk1.6.0_11 and added the path D:\java\jdk1.6.0_11\bin to my system path. Ant compiled my code!