| Author |
Deleting a file in java
|
Tim frank
Greenhorn
Joined: Mar 07, 2006
Posts: 25
|
|
Hey guys, im currently working on a virus scanner, its all working perfectly except for it wont delete the binary files for some reason. I have: It doesn't work tho, the boolean value returned is always false. Does anyone know why its not working? Much appricaited.
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
The most obvious explanation is that there's no such file; try checking the value of afile.exists(). Since you're on Windows, another important possibility is that the file is open for reading or writing; the OS won't let you delete an open file. Make sure it's closed.
|
[Jess in Action][AskingGoodQuestions]
|
 |
Kanu Dialani
Greenhorn
Joined: Apr 30, 2005
Posts: 23
|
|
|
Also if u have any stream open which is using that file in ur java class it wont delete the file !
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24057
|
|
That's a good point -- which is why I made it. Kanu, a bit of business: you may not have read our naming policy on the way in. It requires that you use a full, real (sounding) first and last name for your display name. Initials aren't enough. You can change your display name here. Thanks!
|
 |
 |
|
|
subject: Deleting a file in java
|
|
|