How to use Eclipse debugger tutorial

How to use Eclipse debugger tutorial, debugging Java application, selecting breakpoints and watched resources.

One of the most useful features in modern programming languages and IDEs is debugging. In Java and Eclipse you must do three things:

  1. Set breakpoints. With them you define lines in your code, where your application will pause. You can easily do that by double click here on your selected line.
  2. Next run your application with this Debug button.
  3. Finally when you hit a breakpoint, Eclipse will show you if you want to switch to Debug perspective. Choose Yes and to remember this decision.

In Debug perspective you have in upper-left corner information about running threads and several buttons for managing your debugging. If you terminate debugging, your application will finish. If you resume, your application will continue running until next breakpoint. You can step into called method, step over one line or step to end of this method.

In upper-right corner you have variables and their values. You can define your own watched variables. Choose what you want to watch and select Watch. This will show dialog "Expressions" with your selected expression.

In dialog "Breakpoints" you have breakpoints in your application. At any time you can activate or deactivate breakpoints. You can also do the same on any breakpoint in your code. Breakpoints can also be activated on some specified condition.