我需要在应用程序关闭时清理一个临时目录。 在Linux和Mac上,以下命令可以正常运行:
public void windowClosing(WindowEvent e) {
Debug.infomess("clean exit");
try {
Runtime.getRuntime().exec("rm -f ./temp/*");
} catch (IOException e1) {
Debug.errmess(e1,"Exit error");
}
System.exit(0);
}
Windows等效于'rm -f'Linux命令。