我正在使用 Process 类执行一个进程。似乎需要通过错误流才能成功执行该过程。为什么要通过流程正确运行所必需的错误流?有什么我做错了吗?
Process wkstdin = Runtime.getRuntime().exec(command);
BufferedWriter wkstdin_writer = new BufferedWriter(
new OutputStreamWriter(wkstdin.getOutputStream()));
//write data
代码的必要部分:
BufferedReader input = new BufferedReader(new InputStreamReader(
wkstdin.getErrorStream()));
String ch;
while ((ch = input.readLine()) != null)
{
System.out.println(ch);
}