You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by khozaima shakir <sk...@hotmail.com> on 2002/08/10 23:30:42 UTC
Reading from files in servlet from Tomcat-4.0.4
Hi all,
I am trying to read from a file : filename
Where should i put this file in tomcat 4.0.4 directory structure?
I tried putting the file in directories:
webapps/ROOT, webapps/ROOT/WEB-INF, webapps/ROOT/WEB-INF/classes in each
instance i get the error message
"The system cannot find the file specified"
I used following statement in servlet code.
bufferin = new BufferedReader(new InputStreamReader(new
FileInputStream(fileName)));
Thanks
Khozaima
_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Reading from files in servlet from Tomcat-4.0.4
Posted by Ben Walding <be...@walding.com>.
Your best bet is to put them in webapps/<WEBAPP>/bob.txt
Then read them using servletContext.getResourceAsStream("/bob.txt");
This will still work when the application is packaged up as a WAR file.
khozaima shakir wrote:
> Hi all,
> I am trying to read from a file : filename
> Where should i put this file in tomcat 4.0.4 directory structure?
> I tried putting the file in directories:
> webapps/ROOT, webapps/ROOT/WEB-INF, webapps/ROOT/WEB-INF/classes in
> each instance i get the error message
> "The system cannot find the file specified"
>
> I used following statement in servlet code.
> bufferin = new BufferedReader(new InputStreamReader(new
> FileInputStream(fileName)));
>
> Thanks
> Khozaima
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>