File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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
Register / Login
JavaRanch » Java Forums » Java » Applets
Reply 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: 35224
    
    7
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.


Android appsImageJ pluginsJava web charts
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: File.delete() returns false in an applet
 
Similar Threads
File.delete()
Unable to delete record - JDBC
recovery after rm command
File Deletion is failing.
Delete file from client system using Jsp / servlet