所以,我应该处理 Ctrl-C。好的,我可以通过注册关闭 Hook 来做到这一点。它运行良好,直到我想阻止关闭。当按下 Ctrl-C 时,我想询问用户是否真的想关闭应用程序,如果不想,那么我希望我的应用程序继续运行。问题是我不知道如何防止按下 Ctrl-C 后关机。
有什么帮助吗? :)
最佳答案
一旦你陷入关机状态,就为时已晚了。
Once the shutdown sequence has begun it can be stopped only by invoking the
halt
method, which forcibly terminates the virtual machine.
关于java - 防止关机钩子(Hook)后关机,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7852857/