I\'m writing string to temporary file (temp.txt) and I want that file should open after clicking button of my awt window it should delete when I close that file
temp.txt
How about something like:
if (!temp.delete()) { // wasn't deleted for some reason, delete on exit instead temp.deleteOnExit(); }