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

The Archive Base Latest Questions

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

I am facing the following problem: I use Eclipse for my Java projects and

  • 0

I am facing the following problem:
I use Eclipse for my Java projects and there I have the following structure:

  --> src
      --> package1
          ....
      --> package2
          ...

   -->dataFolder
       --> Folder1
            --> file1.xml
       --> Folder2
            file2.xml

In my java project I parse all files in the dataFolder directory. This is no problem because I can just use the root directory of the eclipse project, like this:

File dataStoreFolder = new File("dataFolder");
Some parsing......

But when I export my project as an executable jar file, I can not access these files anymore. Of course thats because they are not in the same folder where I put my exec.jar file. But I do not want to copy the whole folder with the data to my exec.jar file. Can I put it somehow inside my jar file? (I did it by adding the dataFolder to the Java Build Path but it still does not work as it does in Eclipse)

Can someone help me please?

  • 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-08T04:09:21+00:00Added an answer on June 8, 2026 at 4:09 am

    When you’re using a jar file, those files don’t exist as files any more.

    You can absolutely include the data in your jar file, but then you’ll need to change the code which accesses it, too. Instead of creating a File object, you’ll need something like:

    InputStream input = Foo.class.getResourceAsStream("/dataFolder/Folder1/file.xml");
    

    So you have two separable tasks:

    • Work out how to include the data folder within your jar file
    • Change your code to access the data appropriately
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing the following problem: I am writing a java-application in Eclipse. Inside
Im facing following problem I have created mentioned condition, but when I choose y
I'm facing following problem actually: I'm using Spring with jQuery. I have Controller: @Controller
I am creating a website and am facing the following problem. I have 2
I am learning facelets and Seam and I'm facing the following problem: I have
I am facing the following problem. Let's say I have a file, which contains
I am facing a weird problem I have defined I a structure in a
I'm learning how to use ActiveMQ and now we are facing the following problem.
Hi i'm facing the following problem, i have to re-write an existant code to
I am facing the following problem: I have a HTML document where I want

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.