Hi alpe gulay,
It seems from your questions that you are a bit of a beginner at Java. Take a look at the post at the top of this forum. It contains several great links that might be able to help you in your journey. The website java.sun.com is particularly helpful, with tutorials, examples and the API documentation as well as many other Java resources.
In answer to this specific question, there are probably many ways to do what you want. Off the top of my head I would suggest taking a look at the java.io.File.deleteOnExit() method for a simple way of deleting any file (and therefore directory) when the virtual machine terminates.
Hope this helps,
darkagn :)
darkagn
Veteran Poster
1,197 posts since Aug 2007
Reputation Points: 404
Solved Threads: 200
A directory is deleted just like any file - with File.delete() . A directory must be empty to be deleted, so if it contains files you must recurse the directory and delete all files and subdirectories first.
Ezzaral
Posting Genius
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847