如何在eclipse中自动终止Java应用程序的实例? [英] How to auto terminate instances of Java application in eclipse?

查看:659
本文介绍了如何在eclipse中自动终止Java应用程序的实例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在做一个小项目,每次运行程序时,我都可以感觉到更多的滞后和延迟,直到它完全不再工作了。
我与任务管理器进行了检查,发现了许多Javaw.exe实例。然后我打开调试字段,并意识到每次运行相同的项目时它都会运行一个新的实例。

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.

感谢任何提前的响应。

推荐答案

不,我确信这不是你想要的。如果您重新启动应用程序,可能您想要测试您在代码中刚刚做出的一些更改。所以Eclipse需要启动一个新的应用程序实例。您还可以启动两个应用程序实例,因为他们需要彼此交谈。

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.

如果要先前启动的应用程序停止,请停止。您的应用程序似乎是一个GUI应用程序。使用应用程序主框架上的关闭按钮将其关闭。就如此容易。

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.

通常不希望杀死一个应用程序,因为它可能需要正确关闭资源,或者在退出之前告诉服务器要离开的任何地方。如果没有用户有意识的请求,Eclipse会杀死应用程序是不明智的。

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.

这篇关于如何在eclipse中自动终止Java应用程序的实例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆