Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » eclipse line by line debugging
eclipse line by line debugging [message #253501] Tue, 08 April 2008 16:38 Go to next message
Eclipse UserFriend
Originally posted by:


I wanted to know if there is some way to debug my Java code in eclipse
line by line, similar to an interpreter as in C/C++.

If yes, can you please explain how to do it.


Re: eclipse line by line debugging [message #253517 is a reply to message #253501] Tue, 08 April 2008 18:29 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by:


Yes, you can do that.

1. open the class you want to step through
2. look for the first line of code you want to step
3. on that line, double click on the gray vertical bar left of the java
code editor. a funny round icon indicating a breakpoint appears.
4. run your project with "Debug as..." instead of "Run as..."
5. when the program passes by the line with the break point, execution
will be interrupted and Eclipse suggests opening the debug
perspective (do so)
6. once there you can see the debug view, the variables and your code
having the current line of execution highlighted
7. now you can step forward using [F6] "Step Over" and [F5] "Step Into"

You can find more information about the Eclipse debugger and all it's
useful features in one of these introductory articles/tutorials: jdt.doc.user/gettingStarted/qs-13.htm

Hope that helps

Re: eclipse line by line debugging [message #253537 is a reply to message #253517] Wed, 09 April 2008 00:50 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by:

Hi Michael,

Thanks so much. That helps a lot.
Re: eclipse line by line debugging [message #1233637 is a reply to message #253517] Mon, 20 January 2014 06:55 Go to previous messageGo to next message
Ritesh Jha is currently offline Ritesh JhaFriend
Messages: 2
Registered: January 2014
Junior Member
Thanks for the advice. I tried your way, but it seems line by line execution is not possible as in case of C/C++. I set the break point and then I keep clicking F5 for line by line execution/checking of the code(which compiles and run perfectly in normal mode). I set a break point on the main method, as I want to see the step by step execution of my code. But I get error which says "Source not found" after a couple of lines. Please explain how can I check step by step execution of my code.

Re: eclipse line by line debugging [message #1718434 is a reply to message #1233637] Wed, 23 December 2015 15:49 Go to previous message
Christopher Hoffman is currently offline Christopher HoffmanFriend
Messages: 11
Registered: December 2015
Junior Member
Alright there is one thing you can try...When you are running in debug mode all the threads java creates to execute your program appear in the top left box that says Debug.

If your project is rather large you don't have to worry much, but if your project is small and you want to see where the current execution point is, as soon as you begin running your program, and you have Eclipse running in debug mode, hit the Pause button on the GUI. This will stop the program execution and open the thread where the program currently is in execution.
You can then click on the different classes listed there to see where the thread is executing.
After you have your point of insertion, you can add more break points in those classes to assist you in seeing how the code works.

So if there is a method call in a loop add a break point at the function call, and Eclipse will add the values of the variables passed to the Variables window in the upper right and as the loop progresses you can watch all your objects being called and see them listed as variables in your screen,

I hope this helps you dealing with larger projects. There are tutorials for setting up in Debug mode, depending on how big your application is, you may have to do some leg work getting your code imported, and running your application in debug mode so Eclipse can remotely connect through the JVM. To setup your application to connect remotely in Mars, click Run->Debug Configurations->Browse for your project.

Next set the port to run on the Debug port that your application runs at, and click Debug, if all goes well you will see your layout change to the debug layout automatically, and all your running threads will be in the upper left screen, where you can now pause them for inspection. Depending on your application size, you may have to be quick to pause your application, where as if you have a GUI and there are pause states, you will have plenty of time to pause, inspect, and add break points.

This requires you have a working project with all your imported source, and you are running your application in Debug mode so Eclipse can connect to it on the JVM backend. Good luck!

Previous Topic:eclipse does not insert @override annotation ?
Next Topic:Java issues
Goto Forum:

Current Time: Wed Jan 20 14:19:12 GMT 2021

Powered by FUDForum. Page generated in 0.03206 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top