0 Replies Latest reply: Mar 3, 2007 8:51 AM by 807606 RSS

    is possible capture InputStream Process to javaws application from another?

    807606
      Hello i have simple problem when launch java web start application to another java program.

           
      I do not succeed to capture the system.out of the application javaws.

      what is problem?

      this is my simple example.
      import java.io.*;
      
          public class Demo {
              static void Demo()throws IOException {
      
                  // start the ls command running
      
                  Runtime runtime = Runtime.getRuntime();
                  Process proc = runtime.exec("javaws http://localhost:7080/myapp/myapp.jnlp" );
      
                  // put a BufferedReader on the ls output
      
                  InputStream inputstream =
                      proc.getInputStream();
                  
                             InputStreamReader inputstreamreader =
                      new InputStreamReader(inputstream);
                  BufferedReader bufferedreader =
                      new BufferedReader(inputstreamreader);
                  
              
                  // read the ls output
      
                  String line;
                  while ((line = bufferedreader.readLine()) 
                            != null) {
                      System.out.println(line);
                  }
      
                  // check for ls failure
      
                  try {
                      if (proc.waitFor() != 0) {
                          System.err.println("exit value = " +
                              proc.exitValue());
                      }
                  }
                  catch (InterruptedException e) {
                      System.err.println(e);
                  }
              }
      
           
      
              public static void main(String[] args) 
              {
                
                try
                {
            
                  Demo();
                }
                catch(Exception ex)
                {
                  ex.printStackTrace();
                  
                }
                  
              }
          }