I would like to assign PID to my java application (if it's possible), and kill every other javaw.exe.
Runtime.getRuntime().exec("taskkill /F /IM javaw.exe");
or PID
Runtime.getRuntime().exec("taskkill /F /PID <ID>");
I know this will kill all javaw.exe, but I need my application still up and running.
It should kill specific java application, but they are having random PID's assign. I though the easiest way would be close all java applications running except mine.
I've did it a little bit different. I've used "wmic", to list all the java process and PID at the end. I am taking the the last numbers and killing them.