I'm trying to run a .bat file in an Ant script, which is as follows:
<property name="winPath" value="C:\jboss-root\jboss-fuse-6.1.0.redhat-379\bin"/>
<property name="cmdPath" value="C:\Windows\System32\cmd.exe" />
<echo message="Windows: ${winPath} | ${cmdPath}" />
<exec dir="${winPath}" executable="${cmdPath}">
<arg value="/c"/><arg value="fuse.bat"/><arg value="-p"/>
</exec>
The output of this script is as follows:
[echo] Executing JBoss Fuse Start Script...
[echo] Windows: C:\jboss-root\jboss-fuse-6.1.0.redhat-379\bin | C:\Windows\System32\cmd.exe
[exec] The system cannot find the path specified.
[exec] Result: 3
The file does exist, and by running the command manually in cmd it executes the script fine.
C:\jboss-root\jboss-fuse-6.1.0.redhat-379\bin>C:\Windows\System32\cmd.exe /c fuse.bat -p
Please wait while JBoss Fuse is loading...
I've tried replacing \ for /, but no change. The Ant documentation says to either place the filepaths in PATH, or use absolute filepaths. I am not able to modify the PATH files, though.
This was caused due to the fact that Ant did not have the correct JAVA_HOME, and was supplying an invalid location to fuse.bat - the error in the log is actually fuse.bat reporting that it can't find java.exe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With