0

This is what my project setup looks like:

Picture of project setup. Packages and libraries '

I'm trying to open the base.html file with:

InputStream in = Thread.currentThread().getContextClassLoader().getResourceAsStream("/HttpServer/htmlFiles/base.html");  

But it's always returning null. No variation of the path I use works ("/htmlFiles/base.html", "/base.html", "base.html"). I have also tried using HTML.class.getResourceAsStream() but the result is the same.

I tried to do this by making a separate source folder for the code and another for the files, but that didn't work either.

What am I doing wrong?

mjuopperi
  • 773
  • 7
  • 25

1 Answers1

1
InputStream in = HTML.class.getResourceAsStream("/htmlFiles/base.html");

should work. Are you sure you tried this one ?

Olivier Masseau
  • 778
  • 7
  • 23
  • I'm almost certain I did, but I never got it to work. This DID work now though. Thanks a lot. I was ready to give up on this! – mjuopperi Nov 20 '13 at 16:18