【发布时间】:2016-09-17 15:55:02
【问题描述】:
我想terminate 我现在的Java Program's Execution 一样,
System.exit(0);
当用户按下key-board 中的key-combination 之一时,
1. Ctrl+C
2. Ctrl+Alt+Del
我搜索了很多,但似乎没有correct。
如果可能的话,请给我一个富有成效的代码 sn-p。
谢谢你,:-)
【问题讨论】:
-
你在哪里运行你的程序? cmd或eclipse
-
Runtime.getRuntime().exit(0);你试试这个
-
@KumaresanPerumal 如何 Runtime.getRuntime.exit(0);会从键盘捕获我的 Ctrl+C 键吗?我想在我的程序无限运行并且在 Ctrl+C 之间按下并终止。
标签: java performance console window console-application