ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <>
Subject Re: How to check availability of an executable?
Date Mon, 25 Feb 2002 12:07:31 GMT
On Mon, 25 Feb 2002, Otto Perdeck <> wrote:

> I need to check whether certain executables are available in my Ant
> build script. Depending on availability, parts of the build would be
> executed or not.

You can use <available> using the file attribute for the name of the
executable and the filepath attribute set to the value of the PATH
environment variable.


<property environment="env" />
<condition property="foo-command-present">
    <available file="foo" filepath="${env.PATH}" />
    <!-- special case for Windows, may be PATH or Path -->
    <available file="foo.exe" filepath="${env.Path}" />
    <available file="foo.exe" filepath="${env.PATH}" />


To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message