aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes JAVA I/O Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "JAVA I/O" Watch "JAVA I/O" New topic
Author

JAVA I/O

Jerret Halter
Ranch Hand

Joined: Feb 03, 2006
Posts: 62
I am trying to work with deleting files and directories in Java 5 but have been unsuccessful. With the following code below a file and directory is created but I cannot delete them. Is there something I am doing wrong?



Jerret Halter<br /> <br /> <blockquote><font size="1" face="Verdana, Arial">quote:</font><hr>If you give someone a program, you will frustrate them for a day; if you teach them how to program, you will frustrate them for a lifetime.<hr></blockquote>
Keith Lynn
Ranch Hand

Joined: Feb 07, 2005
Posts: 2367
Remember that Windows locks files when they are open. Because you don't close the BufferedReader before you try to delete the file, it won't delete. Close the BufferedReader first, and it will delete.
Jerret Halter
Ranch Hand

Joined: Feb 03, 2006
Posts: 62
Fantastic :-) Thank you for the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JAVA I/O