11

How do I get eclipse to terminate? I use the keyboard shortcut Ctrl+F11 to run a program and I cannot enable the terminate hotkey, since in development I run the program 100s of times per day I waste a lot of time clicking the red terminate square.

I have looked at previous postings of this question and have gone to Windows --> Preferences --> General --> Keys and found "Terminate" command: I have set it to binding Shift+Ctrl+F11 and set the "When" setting to "In Windows". I have tried various other options but the shortcut never works. Why?

xav
  • 5,452
  • 7
  • 48
  • 57
William Grimes
  • 675
  • 2
  • 11
  • 29
  • You should try using 'Terminate and Relaunch' instead of running 100s of times. This should ensure each time you run, you will terminate the last run automatically. You can set a shortcut for it in Preferences > General > Keys (search for it using the filter). – ADTC Jul 23 '13 at 10:22
  • I just tried to set terminate and relaunch to various key bindings, but it doesn't do anything. I put the When column to 'In Windows' is that correct? – William Grimes Jul 25 '13 at 04:47
  • 'In Windows' should be correct, but you can also try 'In Dialogs and Windows'. Worst case scenario, just add a timer or some form of timeout to your application so that it will terminate itself after some idle time (5 or 10 sec maybe good) or idle runs. This way all the old runs will timeout, and you will only have to click the 'double X' button in the Console pane of Eclipse to remove the terminated runs (all in one go). When you release the application, simply disable or remove this timeout. – ADTC Jul 25 '13 at 05:49
  • I just tried in windows and dialogs but it does not work – William Grimes Jul 26 '13 at 03:52
  • actually I found the solution. I will post as an answer. – ADTC Jul 26 '13 at 07:44
  • hey, I didn't hear back from you. Did my answer help? :) – ADTC Jul 28 '13 at 17:20

6 Answers6

3

Addendum: Unfortunately there is no keyboard shortcut for the Terminate/Disconnect All option mentioned below and you cannot manually set one. But at the very least, you should be able to terminate all launches with just one mouse click with the instructions below. I would consider this a solution to a significant part of your problem, which is wasting a lot of time clicking the red Terminate square.

To terminate all launches:

First Time Setup:

  • In the menus, click Window > Show View > Other...
  • Type debug in the search box and select Debug > Debug
  • Click OK. The Debug pane will open.

Following which, how to terminate all launches:

  • Open or switch to the Debug pane.
  • Right-click on any of the items in the pane to get the context menu.
  • Click Terminate/Disconnect All.

Tips:

  • If the Console pane is annoying you by opening automatically, either separate the Debug pane from the Console pane (so they don't share the same section) or disable these two buttons in Console pane's toolbar:
    • Show Console When Standard Out Changes
    • Show Console When Standard Error Changes
  • Some of the items in the Debug pane may not enable the option to terminate all. In this case, try right-clicking other items that look different.

Thanks to this SO Q&A, but it wasn't fully clear: Eclipse : How to terminate all applications at once?

Community
  • 1
  • 1
ADTC
  • 8,999
  • 5
  • 68
  • 93
  • ADTC thank you for your efforts in finding a solution. I followed your steps and can indeed terminate the program by this method, however it is not exactly what I was asking. I want to set a keyboard shortcut to terminate the program. – William Grimes Jul 29 '13 at 01:35
  • To further elaborate, for convenience when I make changes to my code I press Ctrl+F11 to run the program, this opens multiple windows and runs my software. I would then like to use a keyboard shortcut to terminate all of these windows, rather than getting the mouse navigating to the console window and clicking a red square, I would like to use a shortcut. I hope that is clear. – William Grimes Jul 29 '13 at 01:37
  • When you say 'multiple windows' do you mean multiple instances of consoles in the _Console_ pane of Eclipse (background is white), or you mean multiple command prompt windows popping up on the desktop (background is black)? AFAICT, unfortunately there's no way to set a shortcut for _Terminate/Disconnect All_ but the single mouse action in the _Debug_ pane is the next best thing to what you're asking for. At least you don't have to click the red square a hundred times :) – ADTC Jul 29 '13 at 02:29
  • By multiple windows I mean my code opens dialog boxes and runs software GUI, it is not all in console. Well it seems there is no resolution for this problem but thank you for the suggestions – William Grimes Jul 29 '13 at 08:31
  • I know there's no _keyboard shortcut_ resolution for your problem and we can do nothing about it (except maybe file a feature request for one), but does the _Terminate/Disconnect All_ menu command work for you to close all the GUI windows? You can at least click it with your mouse, and it will save you from the headache of clicking the red button a hundred or thousand times. You only have to select this option once to end everything. Have you tried that? Does it work as described for you? – ADTC Jul 29 '13 at 10:55
  • Sorry I did not communicate clearly, when I say I clicked terminate button 100s of times I mean because I run the program 100s of times, fortunately when I terminate it closes all windows both with your solution and the red button. What I ask since I press Ctrl+F11 to run a program it would be nice to have a shortcut to to quickly terminate the program. I am working on imagej development so when I run my code, it launches a program that will remain open, so I have to terminate each time before re-running the program. – William Grimes Jul 30 '13 at 01:48
  • Hmm, so it's a single program that can have a 100 windows? Or a 100 programs each having 100 windows (100 x 100 = 10,000 total windows)? Maybe you should consider changing the implementation such that the window doesn't remain open once it's no longer needed. What is the window for? And it looks like your issue is the Terminate keyboard shortcut is not working in your Eclipse installation. Is that so? – ADTC Jul 30 '13 at 04:48
  • Yes the problem is 'I cannot enable the terminate hotkey', the terminate shortcut is not working. – William Grimes Jul 30 '13 at 06:09
  • I am writing a software plugin for image processing, so when I run the program, the software window opens, several images open and my plugin opens. I need all of this for debugging, but I run the program many times and make small changes. I just mean it is a little bit annoying that I can efficiently run the program with a keyboard shortcut but have to use the mouse and click a red square to terminate. I thought there must be a shortcut. – William Grimes Jul 30 '13 at 06:11
  • Try looking at [this question](http://stackoverflow.com/questions/321118) for some tips. But I found that the _Terminate_ keyboard shortcut behaves very strangely. It works in the _Debug_ view, and it works seamlessly **ONLY** when you are **debugging** the application. When you are merely running the application, you **have** to select the root node in Debug view and hit the shortcut. The keyboard shortcut is **_not_** tied to the red Terminate button in the Console view (which IMO is a very stupid design, but oh well). – ADTC Aug 03 '13 at 06:57
  • 1
    Thanks for all of your help ADTC, I have read that post as well. Maybe I can put in a request to eclipse to look into this – William Grimes Aug 05 '13 at 02:13
2

Since CTRL + F2 does not work unless you have:

  • previously activated the debug view and
  • selected the process that you want to terminate

The best that I can come up with is to use the "Keys" preferences to assign CTRL + SHIFT + F2 to "Show View Debug", then you can type the following:

CTRL + SHIFT + F2 (activates the debug view) DOWN (move cursor down onto the first process) CTRL + F2 (Terminate) F12 (activate editing window)

Paolo Forgia
  • 6,572
  • 8
  • 46
  • 58
Malcolm Boekhoff
  • 1,032
  • 11
  • 9
1

You can basically use Ctrl+F2 to terminate Eclipse.

xav
  • 5,452
  • 7
  • 48
  • 57
Chetan Potdar
  • 827
  • 1
  • 7
  • 12
  • You can try this out Window->Preferences->General->Keys and add mappings for other layout that is used – Chetan Potdar Jul 23 '13 at 08:20
  • Argh, this doesn't work for me neither. I'm on Mac using Eclipse Luna 4.4.1. In the preferences window the binding for the "Terminate" command is set to CMD+F2. There are no other bindings for CMD+F2. There are no other bindings for the "Terminate" command. I can press the red "Terminate" button in the UI and it works fine. But when I hold down CMD and F2 then nothing happens, the shortcut doesn't work :-( – neoneye Dec 27 '14 at 21:58
  • See [Stack Overflow: What is the shortcut in Eclipse to terminate debugging/running?](http://stackoverflow.com/a/6443447/1694043) for more help on getting this keyboard shortcut to work. – Freek de Bruijn Feb 05 '16 at 13:28
  • None of the solutions proposed under the URL work as of now. – Koenigsberg Jul 12 '19 at 12:22
0

Use Ctrl+F2 to terminate the current running server, not eclipse. There is no shortcut key to terminate eclipse.

Try here:

http://www.developersbook.com/eclipse/eclipse-keyboard-shortcuts-2.php

http://eclipse-tools.sourceforge.net/Keyboard_shortcuts_%283.0%29.pdf

Yes you are right. In fact if you check Windows --> Preferences --> Keys --> Terminate, "Terminate and relaunch", it is showing for server, not eclipse.

xav
  • 5,452
  • 7
  • 48
  • 57
Tanu Garg
  • 3,007
  • 4
  • 21
  • 29
  • 1
    The first link does not mention anything about a terminate shortcut, the second link does not show a key combination for terminate. So I infer from that it should be set by the user, which I have done through the eclipse UI but it still does not work. One would think such a commonly used command would have a shortcut. – William Grimes Jul 23 '13 at 08:01
  • So there is really no way to enable a shortcut to get eclipse to terminate? – William Grimes Jul 24 '13 at 06:41
  • "There is no shortcut key to terminate eclipse." Umm... Alt-F4? – ADTC May 25 '16 at 17:09
0

I think you are looking for this:

  1. Go to Properties -> General -> Keys
  2. Look for "Stop" in my case there are 3, use the one under Category "Launch Bar".
  3. Assign your hotkey and set "In Windows" under the "When" option and apply.

This terminates the running process, even if the hotkey is called "Stop", wich is somewhat confusing, since there is another hotkey called "Terminate".

Regards!

-1

I manage to make it work, binding terminate command to PAUSE key with "when" clause to "In window". It works if in debug, not in run. Hope it helps

Marco
  • 47
  • 4