Debugging Java Application in Eclipse IDE

A Programmer many times try to locate and fix the bugs (errors) in the program code. Basic meaning of debugging a program is to start with a problem, isolate the source of the problem, and then fix it. When a programmer says he has debugged the program it means bugs has been worked out and bugs no longer exist.

From a Java Programmer there are a varieties of tools but if you are using an editor then it becomes quite easy for you to debug the program.

Here are the steps to be followed to debug a Java program using Eclipse.

  1. The very first step in debugging is to load your application and open the “java” file that you wish to debug. Do not forget to switch to Debug perspective.
  2. Now a window will be appeared where you can find several options for debugging the project. It is better to describe about the options available here. Using Eclipse you can debug not even a Java application but also a Remote Java Application (by specifying the remote port number), Junit Test Case, SWT Application etc. After supplying the arguments. Click the “Debug” button. Debugger will connect to your java application under debugger perspective.
  3. Now you can enable or disable debug points in the application by just making a double click on the line where you want to stop execution of the program.
  4. Now you can enable or disable debug points in the application by just making a double click on the line where you want to stop execution of the program.
  5. Now use can use either keys F5-F8 or bar shown below debug window for debugging the application.
    Here is the use of each button for debug purpose.

    • Step Into: To go inside a Method.
    • Step Over: To bypass the next line of code.
    • Step Return : To come out of the current execution of method to original from where you stepped in.
    • Resume: to resume from the current breakpoint.