Adding a resource to a NetBeans project
807589Aug 5 2006 — edited Dec 18 2008I am working on a NetBeans (V5.0) project, and have a small image that I wish to include in the resulting .jar file. I'll use getResource(), etc., to refer to it, so I don't have to worry about files outside the .jar file. This is fairly standard practice, and I expect to do the same kind of thing with other types of file.
So, in my NetBeans project, I created a subfolder images under the classes folder under the build directory, added my image file into the images subfolder, and then referred to the image file relative to my Java class file.
Things were working fine, until I found a need to do a 'Clean and Build Main Project' from NetBeans. I discovered that this wiped out my images directory and everything in it, including my image. I'm guessing that perhaps I didn't make NetBeans aware that this resource should be part of my distributed project -- i.e. it should be in the .jar file.
I've been trying to find out the official approach to adding a resource to a NetBeans project, so that NetBeans can keep track of the resource, and know not to arbitrarily remove it. Unfortunately, while there are reams of information about lots of advanced and arcane stuff for NetBeans, finding out fairly simple stuff like this seems like it's a challenge.
Can anyone give me some guidance?
It would be much appreciated