I (Java newbie) am running a Java program in Eclipse (project I downloaded from SourceForge). When I debug it, it always ends up at this location, which occurs after a 50-line try block:
catch (Exception ex){
System.err.println("PROCESSING ERROR: " + ex.getMessage());
helpFormatter.printHelp(usage, options);
}
How can I find and debug the line of code that triggers this exception? (i.e. see the line number, inspect local variables, evaluate expressions, etc.) If I place a breakpoint after the catch, I don't see any way to get back to the original error or at least find out the line number. I could step through the code in the try block, but there are a lot of loops, so that could get extremely time consuming.
How can I debug this?
Have a look at the stacktrace. You can find inyside an Eclipse tab somewhere, or print it directly when you catch the exception:
catch (Exception ex){
ex.printStackTrace();
}
Inspecting the stacktrace is the fast and most secure way to find your error quickly. Even if you set a breakpoint (or worst use some print to locate the last statement executed) you won't be able to determine exactly where the exception occurred. In fact the exception could have been raised a lot deeper inside your calls stack, not necessarily in the first method called after the breakpoint.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With