Drukowanie strumienia wejściowego Java z procesu

UPDATE: I found a crucial part to why this probably isn't working! I used System.setOut(out); where out is a special PrintStream to a JTextArea

To jest kod, ale mam problem z tym, że informacje są drukowane dopiero po zakończeniu procesu.

public Constructor() {
    main();
}

private void main() {
    btnStart.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                ProcessBuilder builder = new ProcessBuilder("java", textFieldMemory.getText(), "-jar", myJar);
                Process process = builder.start();
                InputStream inputStream = process.getInputStream();
                BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream), 1);
                String line;
                while ((line = bufferedReader.readLine()) != null) {
                    System.out.println(line);
                }
                inputStream.close();
                bufferedReader.close();
            } catch (IOException ioe) {
                ioe.printStackTrace();
            }
        }
    });
} 

Wyjście prądowe:

Line 1
Line 2
Line 3
Line 4
Line 5

Jest to poprawne wyjście, ale jest ono drukowane tylko jako jeden duży blok po zakończeniu procesu.

Czy ktoś wie, o co chodzi? Jeśli tak, możesz mi wyjaśnić, dlaczego tak się dzieje, z góry dziękuję.

questionAnswers(2)

yourAnswerToTheQuestion