Vijay
Vijay

Reputation: 85

Suppress Java Ctrl+Break behavior

Java (at least versions 7 and 8 which I have tried) has a default behavior where when it receives a Ctrl+Break signal, it writes out a full thread dump. Is there some way to disable this or suppress this output?

Upvotes: 2

Views: 486

Answers (1)

VGR
VGR

Reputation: 44355

According to the Non-Standard Options section of the manual for the java command, you can use the -Xrs option to disable it:

-Xrs

Reduces the use of operating system signals by the JVM.

There are two consequences of specifying -Xrs:

  • Ctrl + Break thread dumps are not available.
  • User code is responsible for causing shutdown hooks to run, for example, by calling System.exit() when the JVM is to be terminated.

As with all -X and -XX options, this is not guaranteed to be available in future Java releases.

Upvotes: 3

Related Questions