I am having some problems with getResourceAsStream() and I just don't understand what am I doing wrong. Here is the code:
(firmname is here just a placeholder)
InputStream templateStream = getClass().getResourceAsStream("/com/firmname/mobile/report/report_new.html");
System.out.println("ReportMaker.save :: inputStream is " + templateStream);
This prints that inputStream is null.
jar tf app.jar shows my report.html in the exact same directory (I copied the path and filename from there as a parameter to getResourceAsStream()). The file is not 0 Bytes long, it has normal html content (about 6 KB).
I can open .jpg images (bigger in size) within this same method using getResourceAsStream() but my html template wouldn't open. It shouldn't be a memory issue too, as I try to open the html as a first thing in this method and nowhere else do I use much memory.
The strangest thing is that it used to work last time I worked on this app (before a week) and I didn't change anything on this method.
As I said, I am sure that it is not a typo in the path, as I checked it 300 times already and copied the path from the jar. I tried with the first backslash ("/") and without it - no good. When I open jpg images I am asked if I want to allow this (my app is not certified and that's one of the annoying security questions). With the html no such question comes, my input stream is just null...
What is wrong here?