Howdy,
Don't even go down this path.  Are you reading or writing to disk?  If
you're reading, use the ServletContext#getResource or
ClassLoader#getResource approach, rather than the File approach.

If you're writing, the servlet specification only lets you write to one
place by default, the context tempdir.  This is a File available as a
servlet context attribute named javax.servlet.context.tempdir.  If you
want to write elsewhere, designate the destination as a context or
servlet parameter, or maybe as an env-entry-ref.  Do not use the current
working directory or path, which is what you're doing with the code
below, as the effects will vary from system to system.

Yoav Shapira
Millennium ChemInformatics


>-----Original Message-----
>From: Chris Milner [mailto:[EMAIL PROTECTED]
>Sent: Thursday, November 06, 2003 6:45 AM
>To: Tomcat Users List
>Subject: Newbie help! - BufferedFile(new
>File("test.txt").getAbsolutePath())?
>
>Hi all,
>
>    try {
>               BufferedReader br = new BufferedReader(new
FileReader(new
>File("temp.txt").getAbsolutePath()));
>               String temp;
>               while((temp = br.readLine()) != null) {
>                       out.println(temp);
>               }
>       } catch(Exception e) {out.println("<h1>ERROR....</h1>" +
>e.toString());}
>
>the br field now has a file using this path c:\winnt\system32\test.txt?
>The txt file and .jsp file are in C:\Program Files\Apache Group\Tomcat
>4.0\webapps\ROOT\testing
>
>How can I tell the jsp (or tomcat) to look in the same directory before
>trying what I assume is the PATH environment variable?
>
>thanks for all your help peeps.
>
>Chris.
>
>NOTE: The information in this email is confidential. If you are not the
>intended recipient, you must not read, use or disseminate this
information.
>Although this email and any attachments are believed to be free of any
>virus, or any other defect which affect any computer or IT system into
>which they are received and opened, it is the responsibility of the
>recipient to ensure that they are virus free and no responsibility is
>accepted by London City Airport for any loss or damage rising in any
way
>from receipt or use thereof. The contents of this message including any
>attachments does not necessarily reflect the view of London City
Airport,
>unless expressly stated to the contrary the message is the work of a
sender
>acting as an individual.
>
>www.londoncityairport.com
>____________________________________________________________
>This e-mail has been scanned for viruses by MCI's Internet Managed
Scanning
>Services - powered by MessageLabs. For further information visit
>http://www.mci.com



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to