aspose file tools*
The moose likes I/O and Streams and the fly likes cant delete a file in Vista using java.io.File.delete() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » I/O and Streams
Bookmark "cant delete a file in Vista using java.io.File.delete()" Watch "cant delete a file in Vista using java.io.File.delete()" New topic
Author

cant delete a file in Vista using java.io.File.delete()

Prasad A Nair
Greenhorn

Joined: Mar 04, 2008
Posts: 1
while trying to delete a file using java.io.File.delete(), it returns true but the file lies intact.

i'm sure there is no handle or stream open on the file..

the same code is running fine in XP..

if anyone can help me.. thanks
thejaswini ramesh
Ranch Hand

Joined: Oct 19, 2005
Posts: 74
This could be a permission issue as i faced a similar problem while creating a file on vista. That is Windows Vista expects the user to "continue" or "cancel" the file operations.
Drews Clausen
Greenhorn

Joined: Jun 05, 2008
Posts: 6
Did you find a solution for this already?

I'm just facing the same problem right now with delete() and renameTo() and don't know what to do.

There are loads of java programs used by Vista users working fine with java.io, there MUST be a solution or a nice workaround.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19784
    
  20

Turn that pesky User Access Control off comes to mind. It's useless anyway: experienced users know what they are doing so they click it away, and non-experienced users hardly take the time to read it and click OK as well.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Drews Clausen
Greenhorn

Joined: Jun 05, 2008
Posts: 6
Rob Prime wrote:Turn that pesky User Access Control off comes to mind. It's useless anyway: experienced users know what they are doing so they click it away, and non-experienced users hardly take the time to read it and click OK as well.


Well, but it wouldn't be a really good solution to tell all users using your programm to turn off UAC, would it?

Anyway: This issue seems to be fixed in some later updates - i kept using Java 6 Update 7, but updated to Java 6 Update 11 a few minutes ago and....*TADAH*, it works. ;)
Avyaya Avi
Greenhorn

Joined: Feb 04, 2009
Posts: 11
So, does it mean You can not delete the file without Java 6 Update 7???

What if we face the same problem in earlier versions of Java?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: cant delete a file in Vista using java.io.File.delete()