如何停止在 IntelliJ 中运行的进程以使其调用关闭挂钩? [英] How do I stop a process running in IntelliJ such that it calls the shutdown hooks?

查看:18
本文介绍了如何停止在 IntelliJ 中运行的进程以使其调用关闭挂钩?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 IntelliJ 中运行我的程序然后使用 STOP 按钮时,它不会调用我创建的关闭挂钩.IntelliJ 中有没有办法让那些调用关闭?

When I run my program in IntelliJ then use the STOP button, it does not call my shutdown hooks that I've created. Is there a way in IntelliJ to have those called on shutdown?

推荐答案

您需要使用运行面板中的退出按钮,而不是停止按钮.注意它只在运行时有效,在调试时无效.

You need to use the Exit button in the Run panel, not the Stop button. Note that it will only work when Running and will not work when Debugging.

如果找不到,请看截图:

Here is the screenshot if you can't find it:

此功能使用特定于平台的代码,目前仅适用于 Windows 和 Linux.一旦 IDEA-56273 得到修复,此功能应该也可以在 Mac 上使用. IDEA 10.5版本修复.

This feature uses platform specific code and currently works on Windows and Linux only. Once IDEA-56273 is fixed, this feature should be also available on Mac. It is fixed in 10.5 version of IDEA.

这篇关于如何停止在 IntelliJ 中运行的进程以使其调用关闭挂钩?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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