How do I setup Eclipse to stop on the line an exception occured?

Posted by Chris Persichetti on Stack Overflow See other posts from Stack Overflow or by Chris Persichetti
Published on 2010-03-18T16:11:24Z Indexed on 2010/03/18 16:21 UTC
Read the original article Hit count: 136

Filed under:
|
|
|

Hi,

How can I setup Eclipse to stop at the point an exception occurred.

I have an Eclipse breakpoint setup to break on an exception. In the code example below, the problem I'm having is Eclipse tries to open the Integer source code. Is there any way to just have debugger break at the point shown in my code example? If I move down the stack trace, I will get to this line, it'd be nice if there's a way to do this without the "Source not found" window coming up.

This can be done in Visual Studio, so it's driving me crazy not being able to find a way to do this in 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
  }
}

© Stack Overflow or respective owner

Related posts about eclipse

Related posts about java