I believe that once data is written to the console, it's gone. There's no way to get it back.
If you want the output to go to two places, replace the Java standard out with an output class that emulates tee. One end of the tee can go to the "real" standard out, the other to a buffer that saves the output for later reading.
When I include the code for reading input, it just stops working, looks like it is waiting for user's input and it doesn't read what's printed by Writer class.
The problem is that the class (jar file) I'm using is compiled and I don't have source code, so I cannot just change methods.
If you cannot change the first application, your next best bet is to pipe the application's output into your application.
It doesn't matter what the application is written in. The command line syntax for IO redirection is the same.