File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java deletion sometimes fails on Windows

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I have the following code which simply deletes a file. When I run this code in my local machine it works fine but when I run it on a batch server (a server for running standalone Java apps as batch jobs), it fails...



What could be the reason? It looks like I have write permissions, but still the file is not deleted.

Thanks for any help.
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Windows you can't delete a file that is open for reading or writing. Probably on the server some other process or thread hasn't closed the file yet.

On UNIX you can do this, by the way; current clients of the file don't see any change, but otherwise the file disappears.
 
Rob Spoor
Sheriff
Pie
Posts: 20381
46
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the file is not still open, does the file or parent folder have any rights on it that prevent you from removing it?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic