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.


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.

  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.