not able to delete the directory through Java

Viewed 19015

In my application I have written the code to delete the directory from drive but when I inspect the delete function of File it doesn't delete the file. I have written some thing like this

//Code to delete the directory if it exists
File directory = new File("c:\\Report\\");
if(directory.exists())
directory.delete(); 

the directoryis not in used still it is not able to delete the directory

5 Answers
Related