I am new in java, so my question can be muddled.
I tried to run some process from java. It is xmr-stack miner. I use code like that:
package com.company;
import java.io.*;
public class Main {
    public static void main(String[] argv) throws Exception {
        try {
            String line;
            Process p = Runtime.getRuntime().exec( "D:\\xmr-stak.exe " +
                    /* some arguments */ );
            BufferedReader in = new BufferedReader(
                    new InputStreamReader(p.getInputStream()) );
            while ((line = in.readLine()) != null) {
                System.out.println(line);
            }
            in.close();
        }
        catch (Exception e) {
            // ...
        }
    }
}
It works perfect for common things.
But I faced an issue that I have no output after some point in xmr-stak. As far as I understand at some point this app create child process. And I didn't see output produced by this child process.
But after very long time working (10+ minutes) I got my output for all this time. It is looks like some output buffer was flashed after overflow. Now I want to understand how to get required output more often in java.
From other side I wrote same logic in c++ (Based on this question SO arswer) And I got my output in time.