You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Per Thomas Jahr <Pe...@nr.no> on 2001/04/03 10:21:25 UTC
How to use the task?
I want to check if the commapi.jar is available in the projects
classpath. I wrote something like this:
<target name="checkcommapi">
<available file="commapi.jar" property="commapipresent"/>
<echo>
${commapipresent}
</echo>
</target>
But it seems like the property commapipresent always equals false. The
commapi.jar is installed in the jre/lib/ext and should be in the
bootclasspath. When I run ant with -verbose I get this message:
checkcommapi:
[available] Unable to find file H:\projects\imst\IMST\commapi.jar to set
property commapipresent
[echo]
false
Has anyone else used the <available> task with sucess?
Per Thomas
Re: How to use the task?
Posted by Stefan Bodewig <bo...@apache.org>.
Per Thomas Jahr <Pe...@nr.no> wrote:
> I want to check if the commapi.jar is available in the projects
> classpath.
Then you shouldn't use the file attribute of <available> as this
searches for files in the filesystem, not for parts of your
classpath.
What you want to do is to use the classname attribute and search for a
class that can only be loaded from that specific jar file.
Take a look at Ant's own buildfile - the check_for_optional_packages
target.
Stefan