File f=new File("MyFile.txt");
if (f.exists())
    f.delete();

You can also use delete() to delete a directory if the
directory is empty.

If you want to remove the data from the file without
deleting the file, create a FileWriter to the file.

FileWriter fw = new FileWriter(f);

The file will now be empty! When you create the
FileWriter object, you have to catch IOException.

Tom
--

On Thu, 11 Mar 1999 15:09:59   Revathy Ravi wrote:
>hello,
>
>In the destroy method of my servlet I wanted to delete the entries in a
>file.(not useing jdbc.  it is a flat file) can some one help me with this.



HotBot - Search smarter.
http://www.hotbot.com

___________________________________________________________________________
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