File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JAVA I/O

 
Jerret Halter
Ranch Hand
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?

 
Keith Lynn
Ranch Hand
Posts: 2399
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fantastic :-) Thank you for the help
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic