next up previous contents index
Next: Fail Up: Exec Previous: Errors and return codes   Contents   Index

Examples

<exec executable="emacs">
  <env key="DISPLAY" value=":1.0"/>
</exec>
starts emacs on display 1 of the X Window System.
<exec ... >
  <env key="PATH" path="${java.library.path}:${basedir}/bin"/>
</exec>
adds ${basedir}/bin to the PATH of the system command.

Note: Although it may work for you to specify arguments using a simple arg-element and separate them by spaces it may fail if you switch to a newer version of the JDK. JDK < 1.2 will pass these as separate arguments to the program you are calling, JDK >= 1.2 will pass them as a single argument and cause most calls to fail.

Note2: If you are using Ant on Windows and a new DOS-Window pops up for every command which is executed this may be a problem of the JDK you are using. This problem may occur with all JDK's < 1.2.

Timeouts: If a timeout is specified, when it is reached the sub process is killed and a message printed to the log. The return value of the execution will be "-1", which will halt the build if failonerror=true, but be ignored otherwise.



Andrew Marlow 2003-07-08