Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

jar (...yes a jar), ImageIcon, files in a package = hell :(

843804Oct 27 2004 — edited Aug 26 2009
Hi, I hate to post a question involving jar's here, but nobody in the jar forum knows how to solve this problem...

I have a package (called life), and I have made a jar which holds this package. In this package I have a bunch of .png images, and a .class file. I need to make an ImageIcon out of these images....but when I view the jar....I get a
Java.lang.nullPointer exception (it simply cannot find the images)

I have been told.....

to change the classpath......didn't seem to work, although im using eclipse, is this a problem? I manually changed the manifest file...still didn't work.

to use
url = cl.findResource("image.png");
drawImage(Toolkit.getDefaultToolkit().getImage(url), 320, 320, this);
this failed miserably

to use
URL url = this.getClass().class.getResource("/Image.png");
this, and any variation of of getResource() has falso failed miserably

And I am ready to kill myself

Please help me :(
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 23 2009
Added on Oct 27 2004
22 comments
389 views