How to get PID of a new process started using RunTime.Exec() in Java on Win2000?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rasmus_Pedersen
Posted On:   Saturday, October 5, 2002 02:47 AM

This is a question that has been discussed before, but I don't think the answer ever was really given by anyone.

My PROBLEM is that I launch a bat file from RunTime.Exec(). The program that is launched by the bat file is BEA Weblogic and I want to be able to kill the process that I launched. The bat file runs in the CMD program on win2000. Even when I use process.destroy() and set the reference to null, the java.exe program remains running the BEA stuff.

I can use "kill -f PID" (finding the PID in the task manager) but this is what I want to accomplish in the java program.

Can anyone help?

Thanks, Rasmus

Re: How to get PID of a new process started using RunTime.Exec() in Java on Win2000?

Posted By:   Christopher_Koenigsberg  
Posted On:   Monday, October 7, 2002 07:55 AM

...I can use "kill -f PID" (finding the PID in the task manager)...



There is a command-line utility in the Windows 2000 Resource Kit from Microsoft, which is like the Unix "ps", as a non-GUI way to give you the PID's of currently executing processes. So you can invoke this from a runtime.exec, parse the output, and then kill -f the PID, again from runtime.exec.

About | Sitemap | Contact