Netbeans:如何在NullPointerException上中断? [英] Netbeans: How do I break on a NullPointerException?

查看:110
本文介绍了Netbeans:如何在NullPointerException上中断?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在netbeans中调试Java程序时,我希望调试器在导致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?

感谢您的帮助

推荐答案

转到调试>新断点(或者CTRL + SHIFT + F8).在右上角的下拉菜单中将断点类型更改为Exception.在异常类"字段中键入java.lang.NullPointerException.选择是中断捕获,未捕获还是同时中断.

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.

这篇关于Netbeans:如何在NullPointerException上中断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆