【发布时间】:2014-01-30 15:35:33
【问题描述】:
我必须在 Mac OS 上执行命令:
killall -KILL "Google Chrome"
当我在终端中执行它或使用此命令运行 .command 文件时,它可以工作。
我在 Java 代码中都试过了
Runtime.getRuntime().exec("/usr/bin/killall -KILL \"Google Chrome\"");
Runtime.getRuntime().exec("killall -KILL \"Google Chrome\"");
Runtime.getRuntime().exec("/bin/bash -c \"killall -KILL \\\"Google Chrome\\\"\"");
Runtime.getRuntime().exec("bash -c \"killall -KILL \\\"Google Chrome\\\"\"");
Runtime.getRuntime().exec("/usr/bin/killall", new String[]{"-KILL", "Google Chrome"});
Runtime.getRuntime().exec("killall", new String[]{"-KILL", "Google Chrome"});
Runtime.getRuntime().exec("/bin/bash", new String[]{"-c", "killall -KILL \"Google Chrome\""});
Runtime.getRuntime().exec("bash", new String[]{"-c", "killall -KILL \"Google Chrome\""});
而且它不起作用。
可能是什么问题?
【问题讨论】:
标签: java macos kill-process