Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 3 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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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