----------------------------------------------------------------
BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
WHEN YOU POST, include all relevant version numbers, log files,
and configuration files. Don't make us guess your problem!!!
----------------------------------------------------------------
Last night I did some testing. I listed the files in the
directory "." from a servlet. The actual directory it listed was "/"
(i.e., the root dir, not any of the apache dirs or servlet dirs).
Is there any way, without giving a fully qualified path, to read
a file in the same directory where the servlet resides? I know
getRealPath doesn't work.
-Tom
Russ Pridemore wrote:
>
> Try something like this:
> InputStream in = ClassLoader.getSystemResourceAsStream("datafile.txt");
>
> Then, your file only needs to be in the server's classpath.
>
> Russ
>
> Dan Martin <[EMAIL PROTECTED]> on 10/27/99 03:13:35 PM
>
> Please respond to Java Apache Users <[EMAIL PROTECTED]>
>
> To: [EMAIL PROTECTED]
> cc: (bcc: Russ Pridemore/GVL/BSM/MCI)
> Subject: Simple problem with file I/O
>
> ----------------------------------------------------------------
> BEFORE YOU POST, search the faq at <http://java.apache.org/faq/>
> WHEN YOU POST, include all relevant version numbers, log files,
> and configuration files. Don't make us guess your problem!!!
> ----------------------------------------------------------------
>
> I am trying to move servlets from a JRUN server to a host that uses JSERV.
> I keep getting an internal configuration error on the servlets that use file
> i/o. I dont think I am getting the path right. I have tried many combination
> without success. Here is a piece of code:
>
> TextInputStream in = new TextInputStream("datafile.txt");
>
> What directory is JSERV looking for the "datafile.txt" file using this
> format.
>
> Thanks You,
>
> Dan Martin
> http://buoyweather.com/
>
--
+-------------------------------------------------------------------+
+ Thomas M. Sasala, Electrical Engineer [EMAIL PROTECTED] +
+ MRJ Technology Solutions http://www.mrj.com +
+ 10461 White Granite Drive, Suite 102 (W)(703)277-1714 +
+ Oakton, VA 22124 (F)(703)277-1702 +
+-------------------------------------------------------------------+
--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Archives and Other: <http://java.apache.org/main/mail.html>
Problems?: [EMAIL PROTECTED]