Re: specifying path for file to be read by servlet with Tomcat
From: hiwa (HGA03630_at_nifty.ne.jp)
Date: 02/08/04
- Next message: Tony Morris: "Re: Hashing"
- Previous message: Timo Nentwig: "Re: Why can't finally{} acces in-try{} variables?"
- In reply to: Yang Xiao: "specifying path for file to be read by servlet with Tomcat"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 8 Feb 2004 01:55:30 -0800
yang2002_99@yahoo.com (Yang Xiao) wrote in message news:<55c6e631.0402071641.34f00eb3@posting.google.com>...
> Hi everybody,
> I'm trying to read a txt file to be used by a servlet to display
> posting topics, I'm running Tomcat 5.0 on Win2k.
>
> (new FileInputStream("C:/JAVA/Topics.txt"));
>
> This seems to work fine, but not portable, but none of the following
> attempts to use a relative path works,
> (new FileInputStream("Topics.txt")) -- classes/Topics.txt
> (new FileInputStream "../Topics.txt")); -- classes/Topics.txt
> (new FileInputStream "/Topics.txt")); -- ROOT/Topics.txt
> (new FileInputStream "http://localhost/Topics.txt")); --
> ROOT/Topics.txt
>
> Please help!
>
> Thanks,
> Yang
FileInputStream needs parameters based on OS file system. If you want
to stick to Web-app/Web-server vocabulary, get the stream from URL.
- Next message: Tony Morris: "Re: Hashing"
- Previous message: Timo Nentwig: "Re: Why can't finally{} acces in-try{} variables?"
- In reply to: Yang Xiao: "specifying path for file to be read by servlet with Tomcat"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|