How to write output of child process in Java
<p>I have written a java code in Eclipse and i am developing a plug-in which embed a button on workbench. When this button is clicked, it opens a batch file (located in <code>c:/program file/prism 4.0/bin</code>)</p>

<p>The code successfully opens the .bat file ! But my next task is write the output of that batch file on my console. I am using Eclipse IDE version 3.</p>

<p>My code is</p>

<pre><code>MessageConsoleStream out = myConsole.newMessageStream();
        out.println("We are on console ! \n Shubham performed action");


try {

      ProcessBuilder pb=new ProcessBuilder("C:\\Program Files\\prism-4.0\\bin\\prism.bat");
        pb.directory(new File("C:\\Program Files\\prism-4.0\\bin"));
        Process p=pb.start();

        int exitVal=p.waitFor();            

       out.println("Exited with error code "+exitVal+" shown and action performed \n");

            out.println("Shubham Process Successful");
            out.println("Printing on console");

        }
        catch (Exception e)
        {
            out.println(e.toString());
            e.printStackTrace();

        }
    } 
</code></pre>
