Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

File.delete() returns false in an applet

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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,
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic