Java tutorial
//package com.java2s; import java.io.IOException; public class Main { public static void clearResource(String targetDir) { String[] str = { "rm", "-r", targetDir }; try { Process ps = Runtime.getRuntime().exec(str); try { ps.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } } catch (IOException e) { e.printStackTrace(); } } }