Get output from a process
<p>This is a second part to my question <a href="http://stackoverflow.com/questions/2006035/how-to-create-a-process-in-java">here</a>. </p>

<p>I now have a process but I want to know how to get the output from the process?</p>

<pre><code>String filename = matlab.getfileName();  
Process p = Runtime.getRuntime().exec("java -cp mediaProperty.java " + filename);
</code></pre>

<p>My mediaProperty.java:  </p>

<pre><code>public class mediaProperty {

    public static Object main(String[] args) {
        Object[] mediaProp = null;
        java.util.List lstMedia = new ArrayList();
        Media media = null;

        try {
            media = new Media();
            lstMedia.add(args);
            mediaProp = media.media(3, lstMedia);

        } catch (Exception p) {
            System.out.println("Exception: " + p.toString());
        } finally {
            MWArray.disposeArray(mediaProp);
            if (media != null) {
                media.dispose();
            }
        }
        return mediaProp;
    }
}
</code></pre>

<p>The mediaProperty.java will return an Object. Inside this is actually String array. How do I get the array? And is the way I'm calling exec() correct?</p>
