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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Reply 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: 2341
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://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: JAVA I/O
 
Similar Threads
To find a largest sector in a given input string of 1's and 0's
check values in a csv file in all files in a directory
Creating my First Object
Reading a file from a directory.
working with files and directories