windows:
Runtime runtime = Runtime.getRuntime();
String[] args = new String[] {"cmd.exe", "/c", "rd c:\\xxx /q /s"};
Process proc = runtime.exec(args);
linux:
Runtime runtime = Runtime.getRuntime();
String[] args = new String[] {"sh", "-c", "rm -f -r /usr/dir"};
Process proc = runtime.exec(args);