I want to kill the particular Java process in Window with the following command line:
taskkill /f /pid <my_pid>
I didn't find a way to get the pid of my process on windows without using JNA api. I found several answers that use JNA but I'm looking for a simpler solution.
Following is the Java code that I used (which does not work):
Field f = p.getClass().getDeclaredField("handle");
f.setAccessible(true);
long handle = f.getLong(p);
System.out.println("Kill pid " + handle);