In my java program I want to kill a process named "DummyBroker"(which is another java program). i could kill it using TaskKill but it needs PID of the process. So how can i fetch the pid for a specific java process and then kill it?
You should take a look at this link : Killing a process using Java
And use something like :
Runtime.getRuntime().exec("taskkill /F /IM <processname>.<extension>")
Otherwise you can maybe use a combinaison of tasklistand split to find the containing line and then find the PID.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With