File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

cannot find resources

 
Michel de Lange
Greenhorn
Posts: 1
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am sorry to trouble you folks with such a seemingly trivial problem, but I cannot work this out.

My servlet cannot find any of my resources (files). In my code, I have

String fileName= "infotext.html";
try{
InputStream fstream = this.getClass().getResourceAsStream(fileName);
DataInputStream in = new DataInputStream(fstream);


etc

And Tomcat never finds the file. I get:

java.lang.NullPointerException
at java.io.DataInputStream.read(Unknown Source)
at sun.nio.cs.StreamDecoder.readBytes(Unknown Source)



My file infotext.html is in WEB-INF/classes/ and for good measure also in
/WEB-INF/lib/resources.jar

Many thanks for your help,


Michel
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic