Can not load the images in Java Swing when running from a .jar-file

Posted by Jonas on Stack Overflow See other posts from Stack Overflow or by Jonas
Published on 2010-05-28T07:34:28Z Indexed on 2010/05/28 7:41 UTC
Read the original article Hit count: 329

Filed under:
|
|
|

I can run my Java Swing application from Eclipse without problems. But when I run it from a .jar-file, the images fails to load.

I load my images with:

setIconImage(Toolkit.getDefaultToolkit().
getImage(getClass().getResource("../images/logo.png")));

How can I load the images so they work even when I'm running from a .jar-file?

© Stack Overflow or respective owner

Related posts about java

Related posts about image