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?
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.
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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With