I created a java application and linked all the classes in a jar file. When I run the project from eclipse, my application runs successfully. But when I try to run my .jar file, I do not get the icons used by my application. In the code, I get my icons from the catalog of images present in the project folder. How can I present these image files to the end user when using a banner?
I load the image like this:
final public ImageIcon iReport=new ImageIcon("images/Report.png");
I also tried
final public ImageIcon iquit=new ImageIcon(getClass().getResource("images/quit.png"));
and
final public ImageIcon iquit=new ImageIcon(getClass().getResource("/images/quit.png"));
But this leads to an error:
Exception in thread "main" java.lang.NullPointerException at javax.swing.ImageIcon.<init>(Unknown Source)
java eclipse jar
sanu
source share