Hi, Deepak.

Deepak C S wrote:

> hi,
>
>         I am trying to delete a file under filesystem in a bean using:

Which filesystem?

>         File f=new File(path-to-file);
>         f.delete();

delete() returns a boolean; you should always check it to be true, since
otherwise you cannot be sure the file was deleted. Something like:
        if (!file.delete())
        {
            throw new Exception ("File couldn't be deleted!");
        }

>         But the File isnt getting deleted...Can anybody help??

I had a similar problema on Win2000. The files still cannot be deleted, so
I don't know what I should do -- theoretically, it shouldn't be a
permission-related problem since I do it from within a servlet. The same
code on Solaris works fine.

Now, if you're on Unix, then check it's not a directory full of things,
you have permissions, etc.

Cheers,

Alex.



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

Reply via email to