Skip to Main Content

Java Programming

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!

Referencing an image in my projects jar file

807606May 25 2007 — edited May 25 2007
I don't seem to be able to reference an image in my netbeans project. Here is what it looks like in netbeans:
http://picasaweb.google.com/cendrizzi/JavaStuff/photo#5068570476760118770

Here is my code that I'm using to reference one of these images:
            URL imageURL = this.getClass().getResource("images/clock.png");
            Image image = Toolkit.getDefaultToolkit().getImage(imageURL);
I'm really new at this so I'm not sure what I'm doing wrong. I've tried "images/clock.png" as shown and just "clock.png" . Neither seems to find it there.

Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 22 2007
Added on May 25 2007
3 comments
272 views