Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to debug my java code in eclipse. By using break points and Debug mode, the control hits the break point after which I can use F6 to navigate through my code.

Consider I have my break point inside a for loop. In Visual Studio 2005, if we hit Execute (F5), it would stop at next breakpoint.

How can I achieve the same in Eclipse?

Also consider, if I make a change while debugging. So I want to stop the execution and restart it again from beginning. Like we have Stop Execution in VS 2005.

Mainly for those who have extensively used Visual Studio 2005, how does eclipse provide similar functionality.

share|improve this question
up vote 4 down vote accepted

I really don't know Visual Studio, so if anybody wants to add to this answer, feel free to do so.

Just set the breakpoint, for example in a for loop, by double clicking the appropriate column:

enter image description here

You now have to run the program debugging mode. Click the appropriate button in the toolbar (the one with the bug).

enter image description here

Your program will stop at the breakpoint and switch to the debugging perspective:

enter image description here

You can now resume the program (which would stop at the breakpoint again) or step through the statements:

enter image description here enter image description here

You'll find extensive information here: Debugging with the Eclipse Platform.

Eclipse supports a feature called Hotswap Bug Fixing (not available in JVM V1.3 or lower). It allows the changing of source code during a debugger session, which is better than exiting the application, changing the code, recompiling, then starting another debugging session. To use this function, simply change the code in the editor and resume debugging.

share|improve this answer
When you hit the bug, it will ask if you want to switch to debugging perspective. A lot of new Eclipse users don't read it all the way through. – surfasb Nov 23 '11 at 5:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .