illegal thread state exception.

I created a thread that runs a process with some 1 gb of data throughput. the process exits for low data. but for huge data. it says illegal thread state of exception.

sample code :

......

Runtime rt = Runtime.getRuntime();

Process child =rt.exec("myprocess.exe hugefile.txt");

child.exitValue();

....

here hugefile.txt contains some 30000 lines of text.

for thisdata. its shouldnt work.

can u suggest me one of the efficient and effective code for

thread processing.

please help me.

[556 byte] By [sanjeev_suku99@yahoo.co.ina] at [2007-11-27 2:12:16]
# 1

You are calling exitValue() before the process exists (and so there's no exit value).

You have to call waitFor() to wait for it to finish.

Process process = Runtime.getRuntime().exec("myprocess.exe hugefile.txt");

int exitValue = process.waitFor(); // You don't have to call exitValue() since waitFor() will also return the exit value

KathyMcDonnella at 2007-7-12 2:06:21 > top of Java-index,Java Essentials,Java Programming...
# 2
Thanks for yu reply i have implement the code but an error occur it says illegal thread state exception.it hasn't exited..it not exiting and also not executing the process.could yu help me in this situation.
sanjeev_suku99@yahoo.co.ina at 2007-7-12 2:06:21 > top of Java-index,Java Essentials,Java Programming...
# 3
i have implement the code but an error occur it says illegal thread state exception.it hasn't exited..it not exiting and also not executing the process.could yu help me in this situation.
sanjeev_suku99@yahoo.co.ina at 2007-7-12 2:06:21 > top of Java-index,Java Essentials,Java Programming...