Currently, I put my icon for my Frame in my "src" folder, where src is inside of the application folder.
I am using Netbeans.
When this runs inside netbeans, it is fine. But when it is compiled as a jar, I've got null exception thrown by this method as it is running.
I've put the same .png file inside the dist folder. Where am I supposed to put the JFrame folder's icon?
It should go in the root folder in the jar file. That's what it means to use an absolute URL, as you did in that case. Your Netbeans "src" and "dist" folders have nothing to do with anything once you generate the jar, so just forget about them. If they are in the jar, then you have done something wrong while creating it.
And by the way it's less confusing to just use an ordinary absolute URL, like this:
Joined: Aug 02, 2012
I am still experiencing some difficulties, I use the directory as you informed me.
I put the bokss.png file in the same folder with the manifest.mf and build.xml.
I even can't execute the application in netbeans.
Actually Paul, the original resource was relative to the class file itself (the ./ works in resources just like in file systems). And that's where the icon should be - inside the JAR file. Don't assume it automatically gets packed. Check if it is, and if it isn't make sure it is.
The location inside the JAR file also matters. If the resource is relative (like ./bokss.png) then the icon must be located relative to the class file. If it's absolute (like /bokss.png) then it must be located to the root of the JAR file. Unlike the manifest file which must be placed inside the META-INF folder inside the JAR file.