tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tim Funk <>
Subject Re: how can I make my Java code write to a file using relative paths
Date Mon, 10 Feb 2003 22:36:31 GMT
Don't rely on relative paths. At any point in time - someone can change 
the current working directory and throw any preconceived notions way off.

Use absolute paths. Get the base path directory by configuring it in 
web.xml or server.xml.


runu rathi wrote:
> Hi all,
> I am using the following statement in my .java file
> out = new FileOutputStream("responses.txt", true);
> I assumed that it should write in a file in the same
> directory as the .java file in web-inf/classes
> but instead it writes in C:\WINNT\system32
> How can I get it to write at a particular place using
> relative paths.
> I shall appreciate any help.
> Thanks,
> Runu

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message