"However, when i execute clean and build, the image does not appear when i execute the jar file. What seems to be the problem and where should I put the image file?"
This is the reason you don't load from a file. You want to load it as an embedded resources from your class path with a URL
Your image should be in a package somewhere in the src
during development. When you build, the IDE with copy that image for you into the class path, and add it to the jar
Then to load from the class path in your code.
Class.getResource(..)
return a URL, so you want to do this
ImageIcon icon = new ImageIcon(MyClass.class.getResource("/images/logo.gif"));