Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File.delete() returns false in an applet

 
Anil M Kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Anil M Kumar
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic