What is the shortcut in eclipse to terminate debugging/running? Looking under Preferences -> Keys says Ctrl + F2 but it doesn't work.
9 Answers
Go to Preferences -> General -> Keys
Find "Terminate" Set your binding to whatever you want (in my case F12).
Then change "When" from "Debugging" to "Editing Java Source".
Works for me, now.
Going to Customize Perspective only showed me the bindings I already had, not let me set them.
-
Excellent! That seems a more appropriate answer than mine. – VonC Jun 23 '11 at 21:37
-
2I just tried this and I can't seem to get the terminate command to execute from a keybinding unless I'm in debug mode. Setting when to anything else just makes it stop working. – E.Z. Hart Aug 03 '11 at 21:14
-
When you set it to "Editing Java Source", and you press your key (i.e. F12), you have to be "in" a Java source file. You can't be in an XML file, or anything. You have to be viewing and focused on a Java source (i.e. your cursor is inside the code and blinking). You may have to click inside your Java source if your perspective-shift causes you to lose focus. Whenever I Run my program, I immediately click back into my code. – Austin Aug 09 '11 at 04:32
-
Under the Preferences -> General -> Keys menu, the "When" column should be set to "In Windows" if you want this binding to work outside of debug mode. NOTE: there may be another key binding set for that key (ie F12 is defaulted to open the current editor), so you may have to remove the default binding to set the "When" column to "In Windows". – modulitos Jul 25 '13 at 03:35
-
Note: F12 is the binding for focusing the editor. This is especially useful for going back to the code when the focus is on package explorer or console for ex. – Janac Meena Jun 28 '16 at 13:59
As said here, you can add/enable the Debug command group to any perspective using
Window / Customize Perspective > Commands
.
(Select the 'Debug' group)
Then open the Debug view in the Java perspective (as a Fast view perhaps) and you should get your Terminate keybinding.
I suppose it was not working because you tried it in a non-debug session.

- 1,262,500
- 529
- 4,410
- 5,250
-
1@Mahes: are you sure that CTRL+F2 isn't already bind to some other command (in Preferences/General/Keys)? – VonC May 19 '11 at 05:38
-
-
@Mahes: but if CTRL+F2 isn't bound to *anything*, that means it isn't bound to the command "Terminate", right? (which is only valid when "Debugging", in the category "Run/Debug"). So, if it isn't bound to anything, it is normal it doesn't stop anything. – VonC May 20 '11 at 06:43
Alright, this is an admittedly lame answer, but here goes. CTRL+F2 just isn't working for me (from any perspective). I have no idea why. I'm running 3.5.2
So I hit Alt, R, T, Enter.
Alt, to get to the top menu bar. R, to select the run menu. T, to select terminate. Finally, enter to actually invoke it. It's really not that bad. Lame? Yes. Faster than a mouse click? Certainly.
-
Great! Thank you! Eclipse sucks big time for not having normal "Terminate and relaunch LAST LAUNCHED" hotkey. – Andrey Minogin Dec 03 '13 at 14:19
-
As an Eclipse user I thought NetBeans sucked big time for not having THAT elementary feature and instead always launching the project you're in no matter which non-main class you have in the editor. – Mark Jeronimus Aug 25 '14 at 18:54
Have a debug view open on your perspective (Alt+Shift+Q, Q -> find Debug). Once your application is running, use CTRL+F7 (Command+F7 on mac) to switch to Debug view, press down to highlight the launched app, and trigger your terminate shortcut
Referring to this answer, I don't think it works all the time because depending on what was run, eclipse might not register the 'terminate' command as available.
For example when I run my project using maven (m2e plugin), the terminate button on console view is available, but not on the menu. See screenshot below (I used Springsource Tools Suite 2.9.2 which is based on eclipse indigo, and m2e 1.0.200)
This is because the launched application is not selected by default on the debug view.
This problem is discussed on eclipse forum thread here.
-
This is exactly the same problem I'm having. I'm on Mac using Eclipse 4.4.1. – neoneye Dec 27 '14 at 22:20
Read all these, but found no simple way. So, I threw together a very simple plugin.
Hope it helps someone else as well.
-
Works great for my Goclipse projects, since I could not find any easy way for relaunching. – jllodra Jul 25 '15 at 14:21
-
Glad it is helping you! Wonder why eclipse still doesn't offer a restart button/command like IntelliJ after all these years. :) – Boon Jul 29 '15 at 07:55
F2 could be already used by your Operating System, which can intercept the keystroke before Eclipse gets a chance.
On macs, the F2 key is often used to increase the screen brightness. This will take precedence over anything that Eclipse will assign it. Translation: when you hit F2 on some macs (depending on your settings), your screen will (try to) brighten, and Eclipse will do nothing.
Hope that helps.

- 11,034
- 6
- 68
- 83
I also ran into this issue, but still didn't find a proper solution.
Apparently, because multiple user program instances can run together, they (eclipse devs) just didn't put a general terminate key.
As I just saw in their bugs section, they're (maybe) working on showing a dialog for selecting which running program you want to terminate when you click on the terminate button (probably will be Ctrl+F2 as default).
You can see the bug page for this issue for further details and updates. hope it helps anyone.

- 216
- 4
- 11
A lot of the above answers work for some people but maybe not everyone. As Scott Biggs mentioned, command-F2 may not work on macs (note that to get F2 on a mac, you also need to hold down the fn key), so you can reset the binding to shift-F2. Worked for me, as long as you are debugging.

- 433
- 4
- 8