Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 207147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T17:42:35+00:00 2026-05-11T17:42:35+00:00

How do I check if a particular class exists in a jar file? I

  • 0

How do I check if a particular class exists in a jar file? I tried available task and it does not seem to work

If there is a way, can I use patterns in it?

For example, I want to check if a class matching pattern **/xyz/foo.class exists in foobar.jar

Any direction appreciated.

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T17:42:35+00:00Added an answer on May 11, 2026 at 5:42 pm

    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"/>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there way to check whether the particular class members are null ? I
I want to check if a particular class is applied to a span inside
I want to check a particular file exist in Azure Blob Storage. Is it
I want to check if a particular page gets redirected or not. However, whenever
Would it be wiser to check if a particular element exists on the page?
I need to check whether a certain class extends or implements a particular interface.
How to check if an attribute exists for a particular entity at runtime. I
I have a div: <div class=test id=someElement style=position: absolute></div> Is there any way to
I need to check whether a particular url is up or not. The format
I want to check a particular website from various locations. For example, I see

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.