Java tutorial
//package com.java2s; import java.io.File; import java.util.Iterator; import java.util.Vector; public class Main { /** List of temporary files created in this session */ private static Vector tempFileList = new Vector(); public static void clearTempDirectory() { // Abandon if we created no files in this session if (tempFileList.size() == 0) return; Iterator i = tempFileList.iterator(); while (i.hasNext()) { try { File f = new File((String) i.next()); f.delete(); } catch (Exception e) { e.printStackTrace(); } } } }