You need to set your JAVA_HOME environment variable.
Try this before the ant command
JDK Location is the root of the JDK installed, such as on mine.
then type SET to check if it worked, and now try your ant command. I also changed my PATH to point to the JDK\bin folder before my JRE\bin folder, but I think Java check JAVA_HOME first.
Try this before the ant command
set JAVA_HOME=JDK LOCATION HERE
JDK Location is the root of the JDK installed, such as on mine.
C:\Program Files\Java\jdk1.7.0_45
set JAVA_HOME=C:\Program Files\Java\jdk1.7.0_45
then type SET to check if it worked, and now try your ant command. I also changed my PATH to point to the JDK\bin folder before my JRE\bin folder, but I think Java check JAVA_HOME first.