Java code to display current output of exe file and wait for input when needed for processing exe, after giving input display new output of the exe file and continue until process ends.
The following is the code that can take entire input needed for exe at a time and then displays entire output.
public class ExecuteSampleExe {
public static void main(String args[]) throws IOException,InterruptedException {
ProcessBuilder builder = new ProcessBuilder("SampleHelloWorld.exe");
builder = builder.inheritIO();
Process process = builder.start();
process.waitFor();
System.out.println("Exit value" + process.exitValue());
}
}