简体   繁体   中英

Start Eclipse's Java debugger line by line without breakpoints

A nice thing that you can do in Visual Studio is to start your program and stop it to debug in the very first line, just by pressing F10 for line by line debugging. This is extremely useful when writing sample code or trying something new.

Is there a way to do this in Eclipse for a Java program? You can't start with line by line because that option is not enabled until you actually start debugging.

I know I could set a breakpoint at the very first line, but then I would have to remove it to actually debug something else.

bounty: for exact answers to the question (if it is even possible) and not a workaround.

The debug configuration for each program has ab option/checkbox “stop in main”. This will do what you describe.

http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/tasks/tasks-java-local-configuration.htm

The "stop in main" mentioned by Holger is to be declared in a launched configuration:

http://help.eclipse.org/indigo/topic/org.eclipse.jdt.doc.user/tips/images/org.eclipse.jdt.debug.ui/stop_in_main.png

The problem is to call that specific configuration from a keyboard shortcut, especially when this isn't always the last one you just launched
(if it were, you could use the shortcut "Run last launched" Ctrl + F11 ).

You can assign a shortcut to open the "run configurations" window , but then you need to select the right configuration to launch.

Or you can assign a true shortcut to a specific launch configuration , which is closer to what you are after, but that need an additional plugin (" Practically Macro ")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM