我要杀死窗户从我的集成测试的外部进程(WindowsXP的32位)。 我想我只是用“taskkill.exe”,但我似乎无法得到它的工作。 基本上,每次我开球一个“taskkill.exe”处理从Java它返回退出值-1073741515,没有打印到std错误/输出。
要重现我写了这个简单的应用程序的问题:
public static void main(String[] args) throws Exception {
ProcessBuilder builder = new ProcessBuilder();
//In my real code, I kill process by its pid. However below also shows the problem:
builder.command("taskkill.exe", "/?");
builder.redirectErrorStream(true);
Process p = builder.start();
BufferedReader r = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = r.readLine();
System.out.println("out:");
while(line != null) {
System.out.println(line);
line = r.readLine();
}
System.out.println(p.waitFor());
}
更多的数据点:
- -1073741515显然意味着“应用程序未能正确初始化”。 对我来说不是非常有帮助,虽然;)
- 我试着一堆taskkill.exe参数的组合; 我试着用前缀“加利福尼亚”,“/ C”的命令。 症状是完全一样的
- 我试图执行该生活在Windows \ System32下,我也得到-10737其他小程序...
- 执行之类的东西“目录”或“回声”工程确定。
上可能是什么问题任何提示吗?