## jarlib-available

### Description

Check whether an extension is present in a `fileset` or an `extensionSet`. If the extension is present then a property is set.

Note that this task works with extensions as defined by the "Optional Package" specification. For more information about optional packages, see the document Optional Package Versioning in the documentation bundle for your Java Standard Edition package, in file `guide/extensions/versioning.html` or the online Extension and ExtensionSet documentation for further details.

### Parameters

Attribute | Description | Required
--- | --- | ---
property | The name of property to set if extensions is available | Yes
file | The file to check for extension | Yes, unless a nested `<extensionSet>` or `<fileset>` is specified

### Parameters specified as nested elements

#### extension

Extension the extension to search for.

#### fileset

FileSets are used to select sets of files to check for extension.

#### extensionSet

ExtensionSets is the set of extensions to search for extension in.

### Examples

Search for extension in single file

    <jarlib-available property="myext.present" file="myfile.jar">
      <extension extensionName="org.apache.tools.ant"
                 specificationVersion="1.4.9"
                 specificationVendor="Apache Software Foundation"/>
    </jarlib-available>

Search for extension in single file referencing external Extension

    <extension id="myext"
               extensionName="org.apache.tools.ant"
               specificationVersion="1.4.9"
               specificationVendor="Apache Software Foundation"/>

    <jarlib-available property="myext.present" file="myfile.jar">
      <extension refid="myext"/>
    </jarlib-available>

Search for extension in fileset

    <extension id="myext"
               extensionName="org.apache.tools.ant"
               specificationVersion="1.4.9"
               specificationVendor="Apache Software Foundation"/>

    <jarlib-available property="myext.present">
      <extension refid="myext"/>
      <fileset dir="lib">
        <include name="*.jar"/>
      </fileset>
    </jarlib-available>

Search for extension in extensionSet

    <extension id="myext"
               extensionName="org.apache.tools.ant"
               specificationVersion="1.4.9"
               specificationVendor="Apache Software Foundation"/>

    <jarlib-available property="myext.present">
      <extension refid="myext"/>
      <extensionSet id="exts3">
        <libfileset includeUrl="false"
                    includeImpl="true"
                    dir="lib">
          <include name="*.jar"/>
        </libfileset>
      </extensionSet>
    </jarlib-available>