How to make sure that only a single instance of a Java application is running?

前端 未结 11 1722
你的背包
你的背包 2020-12-09 20:23

I want my application to check if another version of itself is already running.

For example, demo.jar started, user clicks to run it again, but the sec

11条回答
  •  爱一瞬间的悲伤
    2020-12-09 20:40

    This is also a good solution if your Appication can schedued in task manager with a unique name

     "tasklist /FI \"IMAGENAME eq "+MyApplication+".exe
    

提交回复
热议问题