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

  • SEARCH
  • Home
  • 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 8210277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T10:01:12+00:00 2026-06-07T10:01:12+00:00

I want to get all jar paths that I can search .class file in

  • 0

I want to get all jar paths that I can search .class file in these jars. I wrote a function to search all the jars under App main folder but encountered a problem — some jar bundles are existed but out of date and not used by OSGi, ex. xxxx_1.0.0.jar and xxxx_1.2.0.jar are both existed, but only 1.2.0 are used by OSGi. If I search in main folder, are of them will be in the result list.

So is there a way to get all the jar files which used by OSGi? Then I can filter out the jar files which not used.
Thanks

Added:
I tried to use this way to get all the Bundles absolute URL, but failed:

StringBuffer sb = new StringBuffer();
Bundle[] bundles = com.ibm.director.services.storage.debugtool.Activator.context.getBundles();
for (Bundle bundle : bundles) {
    java.net.URL url = bundle.getClass().getProtectionDomain().getCodeSource().getLocation();
    sb.append("File:" + url.getFile() + ", Path:" + url.getPath() + "\n");
}

But hundred times of following output repeated:

File:/opt/ibm/director/lwi/runtime/core/eclipse/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030-RCP20120203-1500.jar
File:/opt/ibm/director/lwi/runtime/core/eclipse/plugins/org.eclipse.osgi_3.4.3.R34x_v20081215-1030-RCP20120203-1500.jar, 
File:....

The number of used bundle is: 588, it might be correct, and we can get absolute Bundles path from the API but why they are all the same? How can I get the real path?

  • 1 1 Answer
  • 0 Views
  • 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-06-07T10:01:14+00:00Added an answer on June 7, 2026 at 10:01 am

    BundleContext#getBundles() gives you all bundles. You can then compare symbolic names and versions. However just because you have both xxxx_1.0.0.jar and xxxx_1.2.0.jar that doesn’t mean that xxx_1.0.0.jar is unused. There might be some other bundles present that require xxx_1.0.0.jar. Likewise just because a bundle isn’t started doesn’t mean it won’t be started later. You do not want to reimplement the OSGi resolver. If you want to clean up a repository I would suggest you use an application provided by the vendor of the repository like GC Application in p2.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want get all of the Geom objects that are related to a certain
i want query a file xml with linq, i want get all descendat of
I want to get all the Applications that have intentlisteners to Intent.CATEGORY_HOME so basically
I want to get all the Calendars, which are in my GoogleAccount, using the
I want to get all characters until there is an uppercase but from the
I want to get all photo fids albums. For example, I have albums and
I want to get all distribution lists & the members of those lists using
I want to get all the values(multiple) of a particular key.But i m getting
I want to get all values of a set interface in one go as
I want to get all the error messages out of the modelState without knowing

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.