I created an ant build for my cordova project as following:
<project default="build">
<target name="init-android">
<exec executable="cordova">
<arg value="platform"/>
<arg value="add"/>
<arg value="android"/>
</exec>
<exec executable="cordova">
<arg value="build"/>
</exec>
</target>
</project>
But I got this error:
C:\path_to_project\build.xml:3: Execute failed: java.io.IOException: Cannot run program "cordova": CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) at java.lang.Runtime.exec(Runtime.java:615) at org.apache.tools.ant.taskdefs.launcher.Java13CommandLauncher.exec(Jav a13CommandLauncher.java:41)
I can run cordova command with no problem from the command prompt, I have:
JAVA_HOME = C:/Program Files/Java/jdk1.7.0_10/ ANT_HOME = C:\Program Files\Java\apache-ant-1.9.2 NODEJS_HOME = C:\Program Files\nodejs
and they are all in my path. I don't understand why it doesn't work. Please help. Thanks