Call console application with the console window open

I have a c++ console application that can print messages to the console window. I am able to use imageJ macro command “exec” to call the console application(in this way the console application does not pop up the console window) and I know that the “exec” can feed back all the results printed by the console application. However, the feedback is only after the console application is completely executed.

Since the console application usually runs for a long time and I’d like to monitor the process real time. Is there a way that the imageJ can get the messages from the console application real time? Or can the imageJ open a console window for the console application to show its messages?

I think in your case you could call the system shell of your whatever OS to display the messages. Here are some macro examples how to do that (look for the ‘sh’ and ‘CMD’ examples):

https://imagej.nih.gov/ij/macros/ExecExamples.txt

Else you have to capture the process output stream with Java or a selected scripting language ImageJ supports.

I tried that, but the system does not help. Maybe I’d try Java. Thanks!