Main { static void delTree(File tempDir) throws IOException { for (File f : new DirTree(tempDir).getFiles()) { if (!f.delete()) throw new IOException("Problem deleting file: " + tempDir.getAbsolutePath()); } }  static void usage(); static void main(String ... args);  }
@Test public void testDelTree() throws IOException { URL jarURL = getClass().getResource("/testjar.jar"); File jarFile = new File(jarURL.getFile()); File tempDir = new File(System.getProperty("java.io.tmpdir") + "/testjar_" + System.currentTimeMillis()); assertFalse("Precondition", tempDir.exists()); Main.unJar(jarFile, tempDir); assertTrue(tempDir.exists()); Main.delTree(tempDir); assertFalse(tempDir.exists()); }