请在下面的java代码中澄清问题

LGA*_*GAP 0 java runtime-error

  import java.lang.Process;    
  import java.io.*;   
  import java.io.InputStream;    
  import java.io.IOException;    
  public class prgms{    
  public static void main(String[] args) {    
    try {    
      // Execute a command without arguments    
      String command = "java JavaSimpleDateFormatExample";    
      Process child = Runtime.getRuntime().exec(command);    

      // Execute a command with an argument    
      // command = "java JavaStringBufferAppendExample";    
     //child = Runtime.getRuntime().exec(command);    
    } catch (IOException e) {    
    }    
    InputStream in = child.getInputStream();    
    int c;    
    while ((c = in.read()) != -1) {    
        process((char)c);    
    }    
    in.close();    
  }    
}    
Run Code Online (Sandbox Code Playgroud)

我已经修改过这种方式......但是发生以下错误,

prgms.java:17: cannot find symbol    
symbol  : variable child    
location: class prgms     
InputStream in = child.getInputStream();    
                 ^
prgms.java:20: cannot find symbol    
symbol  : method process(char)    
location: class prgms    
        process((char)c);    
        ^    
2 errors   
Run Code Online (Sandbox Code Playgroud)

Bal*_*usC 8

你确实忽略了返回的stdoutstderr流.ProcessRuntime#exec()

这将是一个很长的故事,所以这里只是一个链接:当Runtime.exec不会.阅读所有四页.