Java: is it possible to disable Ctrl-C in a Java console application?

As indicated in the subject, is there a way to disable CTRL-C (and other signals) so that they do not interrupt the application?

+5
source share
3 answers

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. , ; - . , .

+5

I would suggest that if you ran KeyListener to handle the press event of ctrl + C, it should either deny the "natural" answer or call the routine that you developed.

+2
source

All Articles