EDIT2 : It May Also Help: Capturing SIGINT in Java
This and this , it seems, you want.
Ctrl-C and another command send “signals” to your program, and if you write code to “catch”, catch these signals, you can change the reaction of your program. Ideally, you would like ctrl-c to terminate the program as the user expected, so keep in mind that you should tell the user why it does not end if you change the response of the program.
Edit3: keylistener - , . Halway down the page - , java linux/Windows - . , , keybaord. , ctrl-c. , ; - . , .