【发布时间】:2011-10-31 08:38:06
【问题描述】:
如何在 Java 中执行带参数的命令?
我试过了
Process p = Runtime.getRuntime().exec(new String[]{"php","/var/www/script.php -m 2"});
这不起作用。
String[] options = new String[]{"option1", "option2"};
Runtime.getRuntime().exec("command", options);
这也不好用,因为没有指定m 参数。
【问题讨论】:
标签: java parameters exec runtime.exec