如何设置 Eclipse 在发生异常时停止。
我有一个 Eclipse 断点设置来在异常时中断。在下面的代码示例中,我遇到的问题是 Eclipse 尝试打开 Integer 源代码。有没有办法让调试器在我的代码示例中显示的位置中断?如果我向下移动堆栈跟踪,我将到达这一行,如果有一种方法可以在不出现“源未找到”窗口的情况下执行此操作,那就太好了。
这可以在 Visual Studio 中完成,所以无法找到在 Eclipse 中完成此操作的方法让我发疯。
package com.test;
public class QuickTest
{
public static void main(String[] args)
{
try
{
test();
}
catch(NumberFormatException e)
{
System.out.println(e.getMessage());
}
}
private static void test()
{
String str = "notAnumber";
Integer.parseInt(str);//<----I want debugger to stop here
}
}
我不知道还能怎样到达那里,但我就是这样做:
Window -> Show View -> Breakpoints
在该选项卡中有一个“J!”允许您在异常上设置断点。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)