problem with the file "Exec.java"

Help
antonio
2007-11-02
2013-05-28
  • antonio
    antonio
    2007-11-02

    Hi.

    My problem is:

    I use the file "Exec.Java" of jsch to execute a process in a machine remote.

    This process delays 10 minutes in finishing. 

    The file "Exec.Java" contains the loop of wait. It is the code:

    byte[] tmp=new byte[1024];

    while(true){
      while(in.available()>0){
         int i=in.read(tmp, 0, 1024);
         if(i<0)break;     
           System.out.print(new String(tmp, 0, i)); 
      }  
        
      if(channel.isClosed()){
         System.out.println("exit-status: "+channel.getExitStatus());
         break;   
      }      

      try{Thread.sleep(1000);}catch(Exception ee){}
    }

    I do not want to wait for the end of the process launched.

    I want to launch the process in the remote machine and finish. 

    I have removed the loop of wait but then the program fails me.

    how could I launch the remote process and close my program (prueba.java for example) in order to the process is executed correctly in it remote machine ???