我用RUNTIME生成了一个进程P,那个进程本身 运行一段时间会自动关闭,又没有办法根据P这个Process对象来判断进程是否已经关闭啊。

解决方案 »

  1.   

     Process.exitValue():   
        
      public   abstract   int   exitValue()Returns   the   exit   value   for   the   subprocess.     
        
      Returns:   
      the   exit   value   of   the   subprocess   represented   by   this   Process   object.   by   convention,   the   value   0   indicates   normal   termination.     
      Throws:     
      IllegalThreadStateException   -   if   the   subprocess   represented   by   this   Process   object   has   not   yet   terminated.   
      如果结束了就有返回值,否则会抛异常。