Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
getResourceAsStream returning null
Joined: Oct 22, 2004
Oct 31, 2008 03:50:00
I am reading a config file from a
program. Below is the code.
str = loader.getResourceAsStream(filename);
It is returning a null. I have placed the file under WEB-INF and also tried placing it under WEB-INF classes. But still its returning a null. Kindly help me out.
Joined: Jun 29, 2008
Nov 01, 2008 10:52:00
can you make your requirement clear,why You need to read it as byte stream?
do You need to send this file to some location or response or You need to read the data from the file
SCJP 1.4,SCWCD5, SCBCD5
Author and ninkuma
Joined: Jan 10, 2002
Nov 01, 2008 11:31:00
Perhaps it might be useful for you to let us know what filename is set to?
And if you are placing the file under WEB-INF rather than in the classpath, you should be using the
rather than the class loader.
Asking smart questions
Books by Bear
It is sorta covered in the
JavaRanch Style Guide
subject: getResourceAsStream returning null
Logging question : Where should I put the log4j jar file?
question about tld
Reading an XML file in a war file
using a static function in XSL
Accessing files under WEB-INF
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013