The API documentation of the constructor of ImageIcon says:
public ImageIcon(String filename)
...
Parameters:
filename - a String specifying a filename or path So it is looking for a file with the specified name. If you don't specify a directory (as you did), it will look for the file in the current directory. If you put your file inside a JAR, then it will not find the file.
Have a look at the API documentation for ImageIcon. It has another constructor that takes an URL. You could use that to load the image from a JAR file like this: