How to auto terminate instances of Java application in eclipse?

你。 提交于 2019-12-11 06:43:30

问题


I was doing a small project and everytime I run the program, I can feel more lag and delay, until it is completely not working anymore. I checked with the task managers and found many "Javaw.exe" Instances. Then I opened the debug field and realize that it runs a new instance everytime I run the same project.

here is the link to image of the instances in debug area.

http://i50.tinypic.com/2hz4spu.png

The temporary solution for me is to terminate them from the debug area. Is there any way to prevent the same project from creating a new instance everytime it is run ? I only need one instance that can be reused everytime I run again and again.

Thanks for any response in advance.


回答1:


No, I'm sure that's not what you want. If you restart an application, it's probably that you want to test some changes you've just made in the code. So Eclipse needs to start a new instance of your application. You could also want to start two instances of an app because they need to talk to each other.

If you want previously launched applications to stop, then stop them. Your app seems to be a GUI app. Use the close button on the main frame of the app to close it. As simple as that.

It's often not desired to kill an application, because it might need to properly close resources, or tell the server it's leaving before exiting, or whatever. Having Eclipse kill apps without a conscious request from the user would not be wise.



来源:https://stackoverflow.com/questions/10976677/how-to-auto-terminate-instances-of-java-application-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!