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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:05:53+00:00 2026-06-11T10:05:53+00:00

I am using eclipse and I use the following code to load my image

  • 0

I am using eclipse and I use the following code to load my image from a folder.

getClass().getResource("/images/image.jpg").getFile())

The image folder is located inside the bin folder in the project folder. It works fine when loading in eclipse, but when I export it to a jar it does not load. I have tried puting the image folder in all possible places in the jar, but it does not.

How do I load an image folder in a jar?

  • 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-11T10:05:55+00:00Added an answer on June 11, 2026 at 10:05 am

    You can use getResourceAsStream() method instead to get InputStream instance with your file data.

    UPDATE: Loading of files from a jar happens with the help of class loader. And it can give you instance of InputStream (not FileInputStream) of any internal resource (be it image file or sound file or text file). File writing shouldn’t work inside jar.

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

Sidebar

Related Questions

I want to use JBoss tools in Eclipse to generate java code from DDL.
When I write the following code, whether Im using Aptana, Dreamweaver or Eclipse, I
I am using eclipse , when I use shortcut to generate override implementations ,
I'm trying to use Google's SDK Tutorial for Android using Eclipse. I was able
I am successfully using Eclipse with emulators. Now I want to use my Defy
I want to use JNI on Ubuntu 8.10, using Eclipse and gcc (the standard
The guys I'm working with use Eclipse as their IDE and I'm using Sublime.
I am using Mac and Eclipse. I used to use ALT + CMD +
I use v 3.4.2 of Eclipse and Subversion (using svn 1.4.6 on the server),
I'm using PyDev 2.5 in eclipse. When ever I use a raw_input command and

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.