This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 /