This content has been marked as final. Show 3 replies
977295 wrote:You may want to try:
InputStream is = cl.getResourceAsStream("/resources/" + filename);
Anyone knows why? And why the exact same code works if I remove "/resources/" and put "tiles.txt" next to the class file? For the record. I am able to load image files from the same subfolder.
Using the classloader the search is already relative to the root of the classpath.
InputStream is = cl.getResourceAsStream("resources/" + filename);
And of course you get a NullPointer because the InputStream reference returned contains null, but your code assumes it is not. Which is fine, that's an assumption you can make as soon as you fix the minor path thing.