2

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?

Mwiza
  • 7,780
  • 3
  • 46
  • 42
Vijay
  • 65
  • 7
  • 1
    This is not an exception being fired. See http://stackoverflow.com/questions/10756105/how-to-get-a-complete-stack-trace-of-a-running-java-program-that-is-taking-100. That said, "stack dump" is the wrong term, it dumps all threads. – Vijay Oct 21 '16 at 23:03

1 Answers1

3

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.

VGR
  • 40,506
  • 4
  • 48
  • 63