The Available task should work, if you give it the exact class name. Here is an example from the ant manual for available:
...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"/>
I don't know of any way to search based on a pattern, short of writing your own task. I guess you could use the unjar task to extract the pattern to a temporary directory, and then check if the file exists. For example:
<property name="temp.dir" value="some_temp_directory"/>
<unjar src="foobar.jar" dest="${temp.dir}">
<patternset>
<include name="**/xyz/foo.class"/>
</patternset>
<mapper type="flatten"/>
</unjar>
<available property="foo.present" file="${temp.dir}/foo.class"/>