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

查看:146
本文介绍了如何停止在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天全站免登陆