aspose file tools*
The moose likes Applets and the fly likes File.delete() returns false in an applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "File.delete() returns false in an applet" Watch "File.delete() returns false in an applet" New topic
Author

File.delete() returns false in an applet

Anil M Kumar
Greenhorn

Joined: Jan 05, 2009
Posts: 3
Hi to all,
I stored a file in the client system from an applet and uploaded to the server. Now I want to delete the file from the client system. When I tried to call delete() method on the file object it is returning boolean value false i.e., the file is not getting deleted. My Applet is an signed applet. Why is it not getting deleted?

Thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41874
    
  63
Is the File object constructed properly? Meaning, does "exists()" return true right before the class to delete? If it does, check the permissions on the file and make sure that the current user has write permission.


Ping & DNS - my free Android networking tools app
Anil M Kumar
Greenhorn

Joined: Jan 05, 2009
Posts: 3
Hi Ulf,

Thanks for your reply. As you said, File.exists() returning true and also the user has permissions to delete files. How can I check from javacode to check file permission.
I even tried FilePermission p = new FilePermission(createdFile.getAbsolutePath(), "read,write,delete"); to set file permission. Still it is not getting delete. How can I debug to get the actual cause.

Thanks,
Anil M Kumar
Greenhorn

Joined: Jan 05, 2009
Posts: 3
Hi Ulf,

I tried to delete the file from a standalone program (a simple program having main method), the file is getting deleted, but trying to delete from an applet program, failed to delete.

Thanks,
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: File.delete() returns false in an applet