I have some java code that runs a subprocess using ProcessBuilder. I can also capture that process stdout and stderr. The process is an GUI application (not written in Java). So far so good, but sometimes the process fails to open a window yet it keeps running.
How can I detect from Java after e.g. 10 seconds whether the subprocess successfully opened a window? Based on that I would like to take recovery action.
A platform agnostic solution is preferred but not necessary. I can live with solutions specific to Linux, MacOS and Windows.