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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:12:23+00:00 2026-06-11T11:12:23+00:00

In eclipse, i have a project i am working on with resources that i

  • 0

In eclipse, i have a project i am working on with resources that i call like this for example

URL url = FighterComponent.class.getResource("/gfx/characters/");
File file = new File(url.getPath() + info.name + "/" + frame.path);

/gfx/ being a folder inside of res. res is my resource folder which i have linked by doing this:

run > run configurations… > Classpath > Select user entries > Advanced > Add folder

My question now is that where should the res folder be after i exported my project into a runnable jar for my friends to be able to test it? I tried putting it in the same folder as my jar and inside my jar and for both the URL was null.

Any idea ?

  • 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-11T11:12:24+00:00Added an answer on June 11, 2026 at 11:12 am

    If the name begins with a '/' ('\u002f'), then the absolute name of the resource is the portion of the name following the '/'.

    So, you should have a gfx/characters directory inside the jar file. Under this directory, if you have an image.jpg resource, you will have to retrieve it using:

    URL url = TheClass.class.getResource("/gfx/characters/image.jpg");
    

    You can also use the getResourceAsStream() to get an InputStream that you can read from.

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

Sidebar

Related Questions

I have a large project I'm working on (using Eclipse) that uses the 1.5
I have an Android project in eclipse IDE which was working. After some imports
Working under linux for our developement, I have an Eclipse Makefile C Project and
I can't seem to get assertions working in my eclipse android project. I have
I'm running Eclipse - Indigo and have a project configured for EGit that uses
I have a project in eclipse (let's call it project A) which is a
I have a project in eclipse on my laptop that I pushed to Git
I'm new in eclipse and I have got a project that can add and
I'm currently working on a school project in Eclipse (We have just started using
In my project, I have a resources directory ( src/main/resources ) that contains properties

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.