In a popular answer regarding the difference between class loading methods, Jon Skeet has stated,
Classloader resource paths are always deemed to be a
Apparently not.
It is up to the class loader to interpret name in getResource(name).
Examining the source code of URLClassLoader, eventually it calls
new URL(baseURL, name)
It is important here whether name is absolute or relative
It is possible that, for some baseURL, absolute /foo/bar and relative foo/bar have the same effect. In particular, this is always the case for "jar file URL" in classpaths
baseURL: jar:file:/home/duke/duke.jar!/
foo/bar -> jar:file:/home/duke/duke.jar!/foo/bar
/foo/bar -> jar:file:/home/duke/duke.jar!/foo/bar