----------------------------------------------------------------
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 have a servlet that requires it be run in from a certain location in the
> filesystem.  That is, it looks for files in the current directory when it
> is running.  It seems that Apache JServ runs servlets from the root
> directory by default.  When I do the following within a servlet, 
> the string
> curDir ends up as "/".
> 
>         String curDir = new String();
>         File curDirFile = new File(".");
>         curDir = curDirFile.getAbsolutePath(); 
> 
> Is it possible to change the directory where Apache JServ runs its
> servlets?  If so, how?

Assuming a current directory is generally not good practice for Java.
I suggest you do either as Jon suggested (use an init param that provides
the directory where your needed files are located) or use something like
getResourceAsStream() to access a file located in the same place your
servlet class was loaded from.

- Fernando


--
--------------------------------------------------------------
Please read the FAQ! <http://java.apache.org/faq/>
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Search Archives: 
<http://www.mail-archive.com/java-apache-users%40list.working-dogs.com/>
Problems?:           [EMAIL PROTECTED]

Reply via email to