Why is my URI not hierarchical? [duplicate]

You should be using

getResourceAsStream(...);

when the resource is bundled as a jar/war or any other single file package for that matter.

See the thing is, a jar is a single file (kind of like a zip file) holding lots of files together. From Os’s pov, its a single file and if you want to access a part of the file(your image file) you must use it as a stream.

Documentation

Leave a Comment