Netbeans: How do I break on a NullPointerException?
When debugging a java program in netbeans, I want the debugger to stop on the line that causes a NullPointerException so I can examine the variables there. I believe I have to use a condition on the breakpoint set at that line, but what is the syntax of the condition?
tha开发者_Python百科nks for the help
Go to debug > New Breakpoint (alternatively CTRL+SHIFT+F8). Change the breakpoint type to Exception in the top right hand drop down menu. Type java.lang.NullPointerException
in the Exception class field. Choose whether to break on caught, uncaught or both.
Debug your code and watch the glorious auto breakpoint when the Exception is thrown.
精彩评论