ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Bennett/Toronto/IBM" <dbenn...@ca.ibm.com>
Subject Re: Problem with the exec task
Date Mon, 18 Sep 2000 15:58:17 GMT

Thanks for the suggestions, but they don't work. I get the same
CreateProcess errors as before.

Interestingly enough, if I create a bat file with the contents "dir" and
call it in the following buildfile, I get the desired output:
<project name="exec_test" default="go">
     <target name="go">
          <exec executable="dir.bat"/>
     </target>
</project>

This is a possible workaround, but we're missing the intended function of
the exec task. Any further help would be appreciated.

Thanks,

David Bennett
416.448.2630
IBM Toronto Lab - Visual Age for Java - ID
dbennett@ca.ibm.com


Emmanuel Pirsch <ep@javatips.net> on 09/15/2000 10:09:50 PM

Please respond to ant-user@jakarta.apache.org

To:   ant-user@jakarta.apache.org
cc:
Subject:  Re: Problem with the exec task




I think it's because you cannot execute internal DOS command.

You can try : <exec executable="command /c dir"/> or <exec
executable="cmd /c dir"/>



David Bennett/Toronto/IBM wrote:
>
> I'm having trouble using the exec task. I've tried testing it with very
> simple targets, but it fails every time.
> I've tried using the August 24 and the September 4 nightly builds of Ant.
> I'm on NT with jdk1.2.2.
>
> Has anyone else had trouble with this?
>
> The buildfile:
>
> <project name="exec_test" default="go">
>      <target name="go">
>           <exec executable="dir"/>
>      </target>
> </project>
>
> The log output:
>
> E:\vaj_nl_rtn\build\buildfiles\vaj_nl_rtn\1.0>ant -buildfile
exec_test.xml
> Buildfile: exec_test.xml
>      [exec] The command attribute is deprecated. Please use the
executable
> attribute and nested arg elements.
>
> go:
>
> BUILD FAILED
>
> exec_test.xml:3: Execute failed: java.io.IOException: CreateProcess: dir
> error=2
> java.io.IOException: CreateProcess: dir  error=2
>         at java.lang.Win32Process.create(Native Method)
>         at java.lang.Win32Process.<init>(Win32Process.java:64)
>         at java.lang.Runtime.execInternal(Native Method)
>         at java.lang.Runtime.exec(Runtime.java:272)
>         at org.apache.tools.ant.taskdefs.Execute.exec(Execute.java:240)
>         at
org.apache.tools.ant.taskdefs.Execute.execute(Execute.java:218)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.runExec(ExecTask.java:213)
>         at
> org.apache.tools.ant.taskdefs.ExecTask.execute(ExecTask.java:154)
>         at org.apache.tools.ant.Target.execute(Target.java, Compiled
Code)
>         at org.apache.tools.ant.Project.runTarget(Project.java:721)
>         at org.apache.tools.ant.Project.executeTarget(Project.java,
> Compiled Code)
>         at org.apache.tools.ant.Project.executeTargets(Project.java,
> Compiled Code)
>         at org.apache.tools.ant.Main.runBuild(Main.java, Compiled Code)
>         at org.apache.tools.ant.Main.main(Main.java:124)
>
> Total time: 1 seconds
>
> David Bennett
> 416.448.2630
> IBM Toronto Lab - Visual Age for Java - ID
> dbennett@ca.ibm.com

--
Emmanuel Pirsch
ETX Solutions, an @gti company
Sun Certified Java Programmer
Unite for Java! - http://www.javalobby.org/
---
"The intuitive mind is a sacred gift and the rational mind is a
faithful servant. We have created a society that honors the servant
and has forgotten the gift."
     - Albert Einstein.




Mime
View raw message