| Author |
handling Java child process execution
|
amit pandit
Greenhorn
Joined: Mar 01, 2007
Posts: 23
|
|
Hi, I am executing a shell script using java program on unix platform. I am using Runtime.exec(shell_script_name) method to execute it. A shell script uses prstat command & it gives well formated output to my java program. But, the problem is that the prstat command doesn't get killed by unix os. so that , when ever I execute the script each time a new instance of prstat is seen as a new process using ps -fu command. & this prstat process seen even when java program is stopped. please, help me so that prstat command execution should get stopped just after script execution finished. Thanks Amit Pandit
|
 |
Vilmantas Baranauskas
Ranch Hand
Joined: Dec 20, 2006
Posts: 89
|
|
Does your shell script launch "prstat" in the background? If not, have you tried to invoke Process.destroy() after you've got necessary outout?
|
Author of <a href="http://www.newsinjector.com" target="_blank" rel="nofollow">NewsInjector</a>
|
 |
Vilmantas Baranauskas
Ranch Hand
Joined: Dec 20, 2006
Posts: 89
|
|
|
BTW, what happens if you invoke the same shell script manually?
|
 |
amit pandit
Greenhorn
Joined: Mar 01, 2007
Posts: 23
|
|
Hi, I have tried with destory() but id doen't help. When i run script manually it runs fine. and prstat command (process) is not seen after execution of script. Thanks Amit Pandit
|
 |
 |
|
|
subject: handling Java child process execution
|
|
|