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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T10:19:09+00:00 2026-06-02T10:19:09+00:00

I have an Eclipse Java project with about 10 external jar dependencies. It works

  • 0

I have an Eclipse Java project with about 10 external jar dependencies. It works fine in Eclipse, also I export it using tools like ONE-JAR and it works fine.

The strange problem I am facing is with images. I have all images in a package inside the project, and when exported they are included but they do not show in the running project?

I have no idea why? Strangely, in some JPanel text, I use HTML with embedded images using e.g:

URL url = myClass.class.getResource( "icons/icon.png");

and this works and shows those images at output, but the ones directly referenced by Java, e.g:

this.setIconImage(Toolkit.getDefaultToolkit().getImage("src/icons/icon.png"));

do not work. This same line of code works perfectly when running from Eclipse. Can you please suggest what could be the problem, or what should I do while exporting this project. Should I switch to Ant or Maven???

  • 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-02T10:19:10+00:00Added an answer on June 2, 2026 at 10:19 am

    You should do this:

    URL url = myClass.class.getResource( "icons/icon.png");
    this.setIconImage(Toolkit.getDefaultToolkit().getImage(url));
    

    Toolkit provides a method accepting a URL as well, see java.awt.Toolkit#getImage().

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

Sidebar

Related Questions

I have recently just created Java project using Eclipse that requires 2 JAR files
I have recently created a web project in Java using eclipse. I have a
For a new Java web project I thought about using: Eclipse as IDE Mercurial
I think about using AspectJ in an existing project. I have several pure Java
I have a Java project in Eclipse that I maintain using a local git
I have the following setup: eclipse a standard Java project (A) an eclipse plugin
I have a Java project in Eclipse with ~10 packages and ~10 class files
Have anyone successfully managed to setup a combined Java/C++ project for Eclipse? What I
I have downloaded Eclipse Java EE version (3.5) and I would like to use
I have a clean Eclipse Java SDK. I would like to make it suitable

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.