class.getResource() returns null when using netbeans

If you are running your project from netbeans directly and you have added a resource to a package and you are trying to access it using

class.getResource(path)

and you find yourself banging your head against the wall because it doesn’t seem to work as it should, then you may need to do a clean build of the project as the resource may be missing from the jar. Wish I had known that before giving myself a bloody forehead and my desk a dent!


About this entry