Run Java program in debug mode
What is Debugging -to find and fix bugs in software
breakpoint - a pausing point in a program, put in place to find and fix the bug. (double click on margin line where you want to put break-point, to remove double click on break-point ).
We will have breakpoint view and variable view ( windows>show view)
"IMPORTANT COMMANDS"
-
Resume - F8 (GO HEAD pause at next breakpoint if any).
-
Terminate - Cntrl + F2 or stop button.
-
Step Over - F6 ( if breakpoint is at line 11, when you run the java application in debug mode it is paused at line 11. So when you press F6 line 11 is executed and the control is given to next line ie; line 12).
-
Step Into - F5 (go into Method Invocation).
step into selection - if we have like Util.Method().getSomeMethod().get(0); and if we press f5 we will go to Method(), what if we want to go to get(0) so select get(0) and press Cntrl+F5.
-
Step Return - F7 (now i went inside a method invocation and want to come back to the place i was use step return which does opposite of Step Into).
"you can skill all breakpoints, remove all breakpoints in the options from breakpoint view".
"HELPFUL COMMANDS"
Run into Line - go to that line without placing breakpoint ( Cntrl + R).
Inspect - Cntrl + Shift + I - inspect the values.
Execute - executes the selected expression ( Cntrl + U)
Watch - using watch we can create custom expressions and evaluate( if we have i and j we can see i+j, i-j, i*j, etc)
Show Logical Structures button -useful while debugging collection objects.
"We can also changing Variable values during debugging".
Display View - see what code is doing. copy the code and put it in display view and execute.
if there s like Util.listMethod().getsubMethod().get(0); and you want the size of listMethod() then use display view; copy Util.listMethod().size() and execute.
Detail Formatter - if we get the value in hexa; if we want it to be more readable. right click and select detail formatter.
Conditional Breakpoint - hit the break point if the value is something also hitcount is useful in cases of iteration.
Exception Breakpoint - if there is exception pause the program ( in breakpoint view options)