Take the 2-minute tour ×

I using Eclipse to export a runnable JAR file from my project file. But the icon image never shows after export. It works when I run through eclipse but not after creating the JAR.

Here is my code that I have in my main method:


Image is the correct directory. Also, tried method using BufferedImage but did not work.

Thanks in advance for your help.

share|improve this question
add comment

2 Answers

An example of how I did:

    Image image =Toolkit.getDefaultToolkit().getImage(getClass().getResource("wood.jpg"));

The above method worked for me when creating a runnable jar.

Hope it helps.

share|improve this answer
add comment

images in a JAR file are treated as resources. You need to use


and then use ImageIcon or other techniques to get the image. See:

How to includes all images in jar file using eclipse

share|improve this answer
add comment

Your Answer


