Hi all,
I want to prevent running my application(from JAR file) for the 2nd time when it is still open. Is there any way to get the process ID for this specific application, so that I can check it every time before it tries to run.
If any JAR file runs, in Windows Task Manager it shows just "javaw.exe". I couldn't find any way to figure out which one is the specific JAR that I'm looking for.
If I read from tasklist and extract only "javaw.exe"as follows:
Runtime.getRuntime().exec("tasklist").getInputStream();
I get the something like this:
. tasklist <<<<<<<<<<<<<<<<<<<<<<,
javaw.exe 2492 Console 0 23,120 K
javaw.exe 2944 Console 0 22,824 K
javaw.exe 2212 Console 0 12,580 K
So, I wouldn't be able to know which one is the ONE I'm looking for.
Can you guys give me any suggesstion?
Please help me.
Thanks in advance.