| <html> |
| |
| <head> |
| <meta http-equiv="Content-Language" content="en-us"> |
| <title>Ant User Manual</title> |
| </head> |
| |
| <body> |
| |
| <h2><a name="available">Available</a></h2> |
| <h3>Description</h3> |
| <p>Sets a property if a resource is available at runtime. This resource can be a |
| file resource, a class in classpath or a JVM system resource.</p> |
| <p>If the resource is present, the property value is set to true by |
| default, otherwise the property is not set. You can set the value to |
| something specific by using the value attribute.</p> |
| <p>Normally, this task is used to set properties that are useful to avoid target |
| execution depending on system parameters.</p> |
| <h3>Parameters</h3> |
| <table border="1" cellpadding="2" cellspacing="0"> |
| <tr> |
| <td valign="top"><b>Attribute</b></td> |
| <td valign="top"><b>Description</b></td> |
| <td align="center" valign="top"><b>Required</b></td> |
| </tr> |
| <tr> |
| <td valign="top">property</td> |
| <td valign="top">the name of the property to set.</td> |
| <td valign="top" align="center">Yes</td> |
| </tr> |
| <tr> |
| <td valign="top">value</td> |
| <td valign="top">the value to set the property to. Defaults to "true".</td> |
| <td valign="top" align="center">No</td> |
| </tr> |
| <tr> |
| <td valign="top">classname</td> |
| <td valign="top">the class to look for in classpath.</td> |
| <td valign="middle" align="center" rowspan="3">Yes</td> |
| </tr> |
| <tr> |
| <td valign="top">resource</td> |
| <td valign="top">the resource to look for in the JVM</td> |
| </tr> |
| <tr> |
| <td valign="top">file</td> |
| <td valign="top">the file to look for.</td> |
| </tr> |
| <tr> |
| <td valign="top">classpath</td> <td valign="top">the classpath to |
| use when looking up <code>classname</code>.</td> <td |
| align="center" valign="top">No</td> |
| </tr> |
| <tr> |
| <td valign="top">classpathref</td> |
| <td valign="top">the classpath to use, given as <a href="../using.html#references">reference</a> to a path defined elsewhere.</td> |
| <td align="center" valign="top">No</td> |
| </tr> |
| |
| </table> |
| <h3>Parameters specified as nested elements</h3> |
| <h4>classpath</h4> |
| <p><code>Available</code>'s <i>classpath</i> attribute is a <a |
| href="../using.html#path">path-like structure</a> and can also be set via a nested |
| <i>classpath</i> element.</p> |
| <h3>Examples</h3> |
| <pre> <available classname="org.whatever.Myclass" property="Myclass.present"/></pre> |
| <p>sets the property <code><i>Myclass.present</i></code> to the value "true" |
| if the class <i>org.whatever.Myclass</i> is found in Ant's classpath.</p> |
| <pre> |
| <property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/> |
| <available file="${jaxp.jar}" property="jaxp.jar.present"/> |
| </pre> |
| <p>sets the property <code><i>jaxp.jar.present</i></code> to the value "true" |
| if the file <i>./lib/jaxp11/jaxp.jar</i> is found.</p> |
| <pre> |
| ...in project ... |
| <property name="jaxp.jar" value="./lib/jaxp11/jaxp.jar"/> |
| <path id="jaxp" location="${jaxp.jar}"/> |
| ...in target ... |
| <available classname="javax.xml.transform.Transformer" classpathref="jaxp" property="jaxp11.present"/> |
| </pre> |
| <p>sets the property <code><i>jaxp11.present</i></code> to the value "true" |
| if the class <i>javax.xml.transform.Transformer</i> is found in the classpath referenced by <code>jaxp</code> (in this case, it is <code>./lib/jaxp11/jaxp.jar</code>). |
| </p> |
| <hr><p align="center">Copyright © 2000,2001 Apache Software Foundation. All rights |
| Reserved.</p> |
| |
| </body> |
| </html> |
| |