Java用cmd 执行命令 例如删除问价 打开文件夹 等等 文件路径空格时可能无法执行
在网上查阅了很多 方法 挺麻烦的
但是 最近网友 “木头” 找到一个比较好的解决方案
本人试过可用
事例如下:
public class Demo{ public static void main(String [] args) throws IOException, InterruptedException{ String[] command = {"javac ","SuffixFilter.java"}; File f = new File("C:\\Documents and Settings\\Administrator\\桌面\\src"); Runtime r = Runtime.getRuntime(); try { r.exec(command,null,f); } catch (IOException e1) { } } }