Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Ant cannot find the path specified

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.

like image 447
Ben Harris Avatar asked Sep 29 '22 12:09

Ben Harris


1 Answers

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.

like image 175
Ben Harris Avatar answered Oct 10 '22 16:10

Ben Harris