I am writing a Java program which accesses a compiled C++ program via a ProcessBuilder. The C++ program takes a while to "start up", but once it has done so, it can take in strings of text and get an output (currently being written to a text file) very quickly.
Essentially, is there a way to have a running process "wait" for an input to be given to it, rather than have to enter the input source as it is started? I don't want to have to restart a process every time a user inputs a String, as that will take too long and is unnecessary. At the same time, I want to start the process, have it "ready", and then prompt the user for an input. As soon as the user does so, I want to send that input to the running process, collect the output, and present that. Is this possible to do?
Thanks!