Link to home
Start Free TrialLog in
Avatar of banyokhing
banyokhing

asked on

Check if java process is running via DFilter parameter

Im running multiple java instances in windows.
Each java process should not be executed/started twice, otherwise it will cause problem on the application.
Is there a way to avoid this?
Im thinking of putting it in to windows services.
Im thinking of using srvinstw.exe but I will need to compile my batch file using Quick Batch File compiler(But I don't have a license though).

By the way, I installed cygwin on my server to run a script that will check if desired java application is already running(ps -efW) however, the result will on display java.exe but the DFilter(name of java) is not reflected, so it seems to be useless.

Any batch script would help.
Thanks
Avatar of doraemon2555
doraemon2555

If you have written the program yourself, you might probably integrate it into your Java program.

Otherwise, just some batch file and create a 'pid' file, and do not run the program when the 'pid' file exists. And delete the 'pid' file after the process return....
Avatar of banyokhing

ASKER

Actually, that is the type of batch scrip I was looking for.
If only I can redirect the PID of my batch file in to a file.
Then from that file, using batch script also, I will check if process is still alive.
If so, I will not start the script, else, start it.
ASKER CERTIFIED SOLUTION
Avatar of doraemon2555
doraemon2555

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial