marlon
marlon

Reputation: 7633

Debug NullPointerException in Eclipse

I ran a program and received an null pointer exception. I added a Java Exception breakpoint and debug. For example, it broke at line 11 in a method called "myMethod". On line 11, it shows that the object "Box" is null in debuger. From here, how can I step back to trace the root of the cause? I think the problem occurs outside of the method "myMethod", because the object Box is passed as a parameter of the method and is shown as null.

Thank you.

Upvotes: 0

Views: 2677

Answers (1)

SomeDude
SomeDude

Reputation: 14228

You should see a stacktrace in the tab called "Debug" in the debug view. When you hit the breakpiont in myMethod, go to the stack trace in the debug view and click on the previous method in the stack trace and look at the value.

Upvotes: 3

Related Questions