Try creating a file ( createNewFile ), and call
ServletContext.getRealPath() on this file. You will find out where a
file gets created by default for this web app.

-- padhu




Piotrek wrote:

Hi all
I have the following problem:
I need to read/write a file for a servlet, both are in my
WEB-INF/classes directory. I use the code below:
String filename="myfile.abc";
File f=new File(filename);
RandomAccessFile raf=new RandomAccessFile(f);

but it doesn't work, it seems like the file is created somewhere in
memory. Everything works fine when is used in an ordinary java class.
When I change the filename to be an absolute path it also works fine:
String filename="D:\\tomcat\\webapps\\ROOT\\WEB-INF\\classes\\";
....
What am I doing wrong?

With best regards
Thank you in advance
Piotr Bieganowski
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to