Re: specifying path for file to be read by servlet with Tomcat

From: hiwa (HGA03630_at_nifty.ne.jp)
Date: 02/08/04


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.



Relevant Pages

  • Re: Image FromStream GDI+ Error with PictureBox
    ... The stream is remaining open. ... I am simply trying to display one image without disposing of ... If, however, I clone the bitmap and try to display the ... from the file system is not a solution. ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: Loading a Remote file
    ... If I use Response.Write to display the HTML Contents, ... // Create a new stream to write to the file ... // Read contents of file into a string ... or the account IIS is using. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Servlet being called multiple times from JSP...
    ... and somehow the SubmitPTO servlet is called TWICE! ... gets called twice even though I see the error messages display. ... When I check the log, I can see that the error messages are displayed, ...
    (comp.lang.java.programmer)
  • Re: Loading a Remote file
    ... If I use Response.Write to display the HTML Contents, ... // Create a new stream to write to the file ... // Read contents of file into a string ... or the account IIS is using. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: File description/title on Vista/NTFS?
    ... the file's header so that the File Explorer can display them. ... The \007SummaryInformation stream if the file uses the OLE compound structured storage format ... A special alternate data stream named file_name:\007SummaryInformation, presumably in the same format as that same stream inside a compound file. ... (This is for NTFS only). ...
    (microsoft.public.win32.programmer.kernel)