开发者

Netbeans: How do I break on a NullPointerException?

开发者 https://www.devze.com 2022-12-27 16:01 出处:网络
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 br

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号