Navigating Java call stack in Eclipse Navigating Java call stack in Eclipse java java

Navigating Java call stack in Eclipse


In the "debug perspective", show the view named "debug". For each thread that is currently halted, this view shows the full call stack. Clicking on one element of this stack switches the editor view to display the corresponding class, and "variables" view will show variables of this stack element.


Note that your "Debug Perspective" may be collapsed to "breadcrumb" view mode by default, which means you'll only see one line of the stack trace at a time.

To fully expand it, and see the stack trace in a tree:

  • click on the down arrow in the top right corner of the Debug View.
  • choose "Layout | Tree"


First, set one or more breakpoints in your code that you know will be hit, then debug your application in one of the following ways:

  • Ensure that the file that contains your main method is currently selected
  • Hit F11

or

  • Right-click the file in Package Explorer that contains your main method
  • Select Debug As > Java Application

Eclipse should now show the 'Debug perspective' (this can be opened manually using Window > Perspective > Open Perspective > Debug)

Once one of your breakpoints has been hit, you should see a frame in the debug perspective titled 'Debug' (to open manually, use Window > Show View > Debug). It looks like this:

enter image description here

The area I've greyed-out is showing each step of the stack trace for the thread that is currently paused on the breakpoint. The actual part of the call stack that is currently being paused is highlighted in grey (so if you have multiple threads, you can see which one is currently paused by looking for the highlighted line). Clicking on any line of the stack trace view will reveal details (e.g 'variables' at that point in the stack)