Question

I have a Java application that launches an external process (Internet Explorer) using ProcessBuilder. Strangely enough, this child process freezes when the parent Java thread calls Thread.sleep. It does not happen with all processes, for instance Firefox, but with IE it happens all the time.

Any ideas ?

P.S. I tried Robot.delay() with the same effect

Was it helpful?

Solution

How are you consuming the child process stdout and stderr ? It may be worth posting your code.

You need to consume the output streams concurrently, otherwise either your stdout or stderr buffer will fill up, and your child process will block. See here for more details.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top