I saw both Class.getResource and ClassLoader.getSystemResource used to locate a resource in Java. Is there any reason to prefer one to another?
From Class.getResource( )
This method delegates the call to its class loader, after making these changes to the resource name: if the resource name starts with "/", it is unchanged; otherwise, the package name is prepended to the resource name after converting "." to "/". If this object was loaded by the bootstrap loader, the call is delegated to
ClassLoader.getSystemResource.
and ClassLoader.getSystemResource( )
Find a resource of the specified name from the search path used to load classes. This method locates the resource through the system class loader