Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

debug java program step by step in Eclipse

Tags:

java

eclipse

I would like to debug the whole flow of a java program line by line and I am using eclipse how can I do that?

like image 378
Chriss Avatar asked Sep 24 '13 09:09

Chriss


People also ask

How do I run a Java program in debug mode in Eclipse?

A Java program can be debugged simply by right clicking on the Java editor class file from Package explorer. Select Debug As → Java Application or use the shortcut Alt + Shift + D, J instead. Either actions mentioned above creates a new Debug Launch Configuration and uses it to start the Java application.

How do I debug a script in Eclipse?

You can launch the debugger through the perspectives in Eclipse. Debug is the first view available in the list of perspectives. Let's see what happens when you launch this perspective. Click on the first option in the “Open Perspective” and click on open.

How do you debug Java code?

Run the program in debug modeClick the Run icon in the gutter, then select Modify Run Configuration. Enter arguments in the Program arguments field. Click the Run button near the main method. From the menu, select Debug.

How do I run a debug test in Eclipse?

With the test class open in the Eclipse editor, simply right click in the editor view and select Debug As > TestNG Test. Eclipse will stop at any breakpoints you set just like it would with any other local debug process.


2 Answers

Create a break point in the first line of your main method then using F5 (step into) to walk through it.

BTW, such questions are all over the web. To be a good programmer, use google wisely.

like image 199
Alex Suo Avatar answered Sep 30 '22 13:09

Alex Suo


  • Set the breakpoints in all the method which you want to debug
  • F3 can be used to navigate into the method
  • Then start the debugging
  • Press F5
like image 45
ArockiaRaj Avatar answered Sep 30 '22 13:09

ArockiaRaj