Is it possible to automatically pause a program when/before an exception is thrown? I’ve seen it in IDEs for other languages, but I just noticed I’ve never used it with Java. Here’s an explanation of how I would want such a feature to work: Whenever something like a NullReferenceException, DivideByZeroException(Error?), or IndexOutOfBoundsException occurs, the program should pause, go back to the statement that caused the exception (so that continuing would cause the same exception to occur again), show the exception message, and give you access to normal debugging features like the stacktrace and local variable view as if you had stopped at that point via a breakpoint or by stepping.
NetBeans (an older version) has a “Stop on uncaught exception” option, but it does not work this way and I am not sure what it is meant to do. It would be much more convenient than the only alternative I can think of: Crash the program when the first uncaught exception occurs, read its stack trace, put a conditional breakpoint on the line, and hope you can reproduce the original problem. (Which is trivially easy for some experimental code I was working on, but impossible to reproduce in a game.)