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)
{
}
}
}
原文链接:https://blog.csdn.net/w605283073/article/details/46572475
本站声明:网站内容来源于网络,如有侵权,请联系我们,我们将及时处理。
还没有人抢沙发呢~