Eclipse如何终止正在运行的程序? [英] How Eclipse terminate a running program?

查看:1042
本文介绍了Eclipse如何终止正在运行的程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Eclipse中,当您运行程序时,有一个很好的红色方形按钮来阻止它。我不知道这是如何做到的。 Eclipse只是残酷地杀死对应的进程,或者是在进程状态之前先进行一些很好的安全验证,然后轻轻地要求它终止本身或其他任何东西。

解决方案>

eclipse如何在进程状态上进行验证或者要求程序终止自己?



它必须是所有Java程序必须实现的Java标准API的一部分。没有什么像这样的。 Ergo:eclipse不能这样做所有它可以做的是发送一个POSIX SIGTERM,但是由于没有Java API对它做出反应,所以它不能被有效地捕获,所以它会导致程序的严重终止。


In Eclipse, when you run a program there is a wonderful red square button to stop it. I wonder how this is done. Does Eclipse just brutally kill the process corresponding or does it some nice safe verification on the process state before gently ask it to terminate itself or whatever?

解决方案

How exactly could eclipse do "verification on the process state" or ask programs to terminate themselves?

It would have to be a part of the Java standard API that all Java programs would have to implement. There is nothing like that. Ergo: eclipse cannot do that. All it can do is send a POSIX SIGTERM, but since there is no Java API to react to it, it cannot be usefully caught, so it leads to a hard termination of the process.

这篇关于Eclipse如何终止正在运行的程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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