【发布时间】:2011-12-09 22:53:52
【问题描述】:
我尝试通过 Java 在 OSX 上删除一个文件,但它不起作用。
Runtime runtime = Runtime.getRuntime();
Process process = runtime.exec(new String[] { "/bin/bash", "-c", "rm file.pdf" });
有什么想法吗?
【问题讨论】:
-
new File(filePath).delete()不起作用吗? :)
标签: java macos file terminal delete-file