I have a jar file that I do not have the source for (It's relatively old). I know that when it runs, it acts as a server (incoming and outgoing connections), and spits out a large amount of console output. What I want to do is have another java application kick it off using an exec, and redirect the stream within itself so that it can watch for certain keywords or timestamps within the output of the jar. The intent of the program is to keep track of certain events and provide a larger picture of when events happen, and "learn" how to react when they do happen in the future.
I'm guessing, from the reading I've done thus far, the tricky part is to get the data in real-time and not after the stream has been closed.
How would I go about doing this?