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 8312913
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T20:19:08+00:00 2026-06-08T20:19:08+00:00

General problem: finding/locating a resource file (document.xml) within a JAR file that has no

  • 0

General problem: finding/locating a resource file (document.xml) within a JAR file that has no fixed position where it can be found and even the name of the file is unknown upfront.

Situation: two JavaSE projects, both create own JAR file. Jar-A holds a xml document somewhere within the jar (location not known upfront). Jar-B wants to ask JarA to hand over the document for a certain operation (e.g. settings information). The caller, Jar-B doesn’t know how what the resource/file is called, and where its current location within Jar-A is.

Requirements: Jar-B should be dependent of fixed locations of resources/files in Jar-A because resources can be renamed or moved around within Jar-A. Jar-B should ask Jar-A where the file is and how the file is called it is looking for.

Possible solution direction:
The META-INF directory always holds a MANIFETS.MF file with key/value pairs. So, if I store a key called ‘ResourceLocator’ and a value like ‘org.my.package.ResourceLocator.class’, then Jar-B can find the class it can load to instantiate a locator object that can give out the correct name and location of the file it is looking for, right?

The resourcelocator can be used for more values to be looked up this way.

Having a resourcelocator object within Jar-A, only the keys to reference to ‘things’ need to be documented, but the actual implementation is decoupled from the outside world.

I am wondering if this is a good approach to deal with this kind of lookup? I already know about the Netbeans Lookup API, but that needs a class/interface name for the lookup. That is not what I am looking for right now.

Any ideas how to make sure the Jar-A and Jar-B stay decoupled when searching for resources not known upfront?

Note: this is not some service loader or extersion mechanism, because that would be the other way around: Jar-B needs to be found by Jar-A. Which is not the case here. Jar-A doesn’t know of any existence of Jar-B.

Hopefully someone came across this ‘problem’ already. Please share your ideas… Thanks!

Link to JAR Specs: here

  • 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-08T20:19:10+00:00Added an answer on June 8, 2026 at 8:19 pm

    JARs are ZIPs. Java has decent native support – seems solid enough – to open JAR-A and paw through the files inside (ZipFile.entries Enumeration.)

    That assumes you can locate JAR-A on the filesystem, which from the sound of your description, I’nm guessing that JAB-B knows exactly where JAR-A is located.

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

Sidebar

Related Questions

I know the general problem of Can't create handler inside thread that has not
Update: After some more reading I see that this problem is totally general, you
I am having a general problem finding a good algorithm for generating each possible
I need a solution to a general problem that i have. I have a
Is makefile an advanced problem or a general problem for a programmer? For a
Don't be scared of the extensive code. The problem is general. I just provided
just had a general question about how to approach a certain problem I'm facing.
The main problem I'm having is pulling data from tables, but any other general
I am looking for a general and complete solution to this common problem! I
I have a parent object that I use for general CRUD in my applications

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.