Control - C exception in Java

I need to catch this exception, but I cannot figure out what it is. The IDE that I am using right now does not allow the program to be interrupted in this way.

I know how the user is trying / catching, but I do not know what I'm trying to catch.

Can anyone help me with this?

+3
source share
3 answers

It seems to me that CTRL-C is becoming InterruptedException, and this article seems to support this. As suggested in other answers, using addShutdownHookis a good way to go if you don't want to prevent a shutdown.

+2
source

Sounds like you need Runtime.addShutdownHook()

.

Java :

  • , - (, System.exit),

  • , , ^ C , .

, , Thread , VM . , , .

+1

Source: https://habr.com/ru/post/1740067/


All Articles