Reading InputStream from Java Process
<p>Im trying to open a terminal console, and be able to read / write commands to it.</p>

<p>I read some questions like: 
<a href="http://stackoverflow.com/questions/3643939/java-process-with-input-output-stream">Java Process with Input/Output Stream</a></p>

<p>With that was able build a little app that opens the terminal and pass commands to the console and print the result back, it works well with any system comand like browsing folders, deleting files and stuff like that.</p>

<p>The problem I have is that I need to load another java program from that console and read its output but that program uses java.util.logging.Logger to send most of its output and for some reason my launching app can't read what Logger prints.</p>

<p>Basically Im trying to build like a wrapper for another java app, because I want to interact with it but cant modify it.</p>

<p>Thanks for your help.</p>

<p><strong>EDIT</strong></p>

<p>Here is the code, but its basically taken from another questions, also as I said it works for things in the "normal" stdout, but not for the output Logger prints to the console.</p>

<pre><code>package launcher;

import java.io.*;
import java.util.Scanner;

public class Launcher {

    public static void main(String[] args) throws IOException {

        String line;
        Scanner scan = new Scanner(System.in);

        Process process = Runtime.getRuntime().exec("/bin/bash");

        OutputStream stdin = process.getOutputStream();
        InputStream stderr = process.getErrorStream();
        InputStream stdout = process.getInputStream();

        BufferedReader reader = new BufferedReader(new InputStreamReader(stdout));
        BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(stdin));

        while (scan.hasNext()) {
            String input = scan.nextLine();
            if (input.trim().equals("exit")) {

                writer.write("exit\n");
            } else {
                writer.write("((" + input + ") &amp;&amp; echo --EOF--) || echo --EOF--\n");
            }
            writer.flush();

            line = reader.readLine();
            while (line != null &amp;&amp; !line.trim().equals("--EOF--")) {
                System.out.println("Stdout: " + line);
                line = reader.readLine();
            }
            if (line == null) {
                break;
            }
        }

    }
}
</code></pre>
