• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java deletion sometimes fails on Windows

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • 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: 24211
35
Chrome Eclipse IDE Mac OS X
  • 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: 20545
56
Chrome Eclipse IDE Java Windows
  • 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?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic