另起一个Thread去waitProcess prc=Runtime.getRuntime().exec(cmd);
Thread thread = new Thread (new Runnable(){
public void run() {
  try{
    prc.waitFor();
  }catch(InterruptedException e ) {}
  if(prc.exitValue() != 0){
     // 在指定的seconds之内子进程没有结束,就强制结束子进程。
     prc.destroy();
  }
}});
thread.start();
synchronized(this){
  try{
    this.wait(1000);
  }catch(Exception e ) {}
  if( thread .isAlive()) 
    thread.interrupt();
}