I am using getClass().getResource("../images/image.gif") to refer to a resource and load it into the ImageIcon. So that my resource's url is dynamic and be got at runtime. It is working fine when I run my program, but when I exported my application into a jar file then while trying to execute the jar file using the
java -jar program.jar command it is giving the following error (Stack trace)
Exception in thread "main" java.lang.NullPointerException
at javax.swing.ImageIcon.<init>(ImageIcon.java:138)
at source.HashCalculator.<init>(HashCalculator.java:130)
at source.HashCalculator.main(HashCalculator.java:2021)