Originally posted by Jeffry Kristianto Yanuar: URL imageURL = sourceClass.getClass().getResource(path);
Since sourceClass is already a Class object, sourceClass.getClass will return Class.class. Just remove the getClass() call.
Where should I put the image files in JAR file assuming all my images is in the directory named images?
If the images directory is put in the root of the JAR file, you can access them by using "/images/myimage.gif" for the path. If the images directory is in the same folder as the class file, just remove the leading /