exec – IllegalThreadStateException: process has not exited

This is one nasty exception I experienced today.

I execute one .executable file from java. Reading the inputstream and the error stream with two different threads (why). I wait till ‘join’ing the thread then I took the process exit value.

 try {
 logger.info("Thread status:"+processLogThread.isAlive()+" "+errorLogThread.isAlive());
 logger.info("Process exit value:"+p.exitValue());
 } catch (Exception e) {
 logger.error("Error while reading process exit value", e);

Unfortunately, it threw the following exception. The streams are closed. Threads are dead. But it says process has not exited. aaw!!

18:19:39,802         INFO Utilities:432 - Thread status:false false
18:19:39,805        ERROR Utilities:435 - Error while reading process exit value
java.lang.IllegalThreadStateException: process has not exited
 at java.lang.ProcessImpl.exitValue(Native Method)
 at org.grassfield.license.util.Utilities.genLicense5(Utilities.java:433)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s