2

I am familiar with What is the short cut in eclipse to terminate debugging/running?. But nothing is working for me. I wish to be able to terminate a running program in the Java perspective in the same manner I able to do so on the Debug perspective with CTRL+F2.

If one could provide a specific details of how to achieve it, It will be really great!

UPDATE

To clear any doubts, Assume a toy example when all we have is as following:

public class ToyExample {
    public static void main(String[] args) {
        while (true);
    }
}

I wish to execute (run) the program above normally (CTRL+F11), i.e. not under Debug mode, and have the ability to terminate it by CTRL+F2 (or another keyboard-shortcut).

Community
  • 1
  • 1
Mr.
  • 9,429
  • 13
  • 58
  • 82

2 Answers2

1

Try enabling the "Debug" command group in the "Java " perspective:

Window -> Customize Perspective -> Command Groups Availability

Tim Gage
  • 1,381
  • 10
  • 19
  • 1
    it is not working my friend. any other idea? (does it work for you?) – Mr. Feb 18 '12 at 11:32
  • It works when you are on a breakpoint. Have a look at: Window -> Preference -> General -> Keys as well. Look for "Terminate". – Tim Gage Feb 18 '12 at 12:44
  • This question is relevant too: http://stackoverflow.com/questions/461743/is-there-anyway-to-modify-the-keyboard-shortcuts-in-eclipse – Tim Gage Feb 18 '12 at 12:45
  • thank you for your reply, though it works by default over the debug prospective. Hence, in my case there is no reason to set a breaking point since I am interested in terminating the program upon a regular execution. Assume a toy example when all you have is infinite loop, then I wish to execute the program normally (under Eclipse) and hit CTRL+F2 to terminate it when desired. – Mr. Feb 18 '12 at 13:03
  • Interesting. Ctrl-F2 never terminates for my unless I am on a breakpoint. If I *am* on a breakpoint it works in either the Java or Debug perspectives. Perhaps part of the problem is that Eclipse can run more than one process at once. How would it know which one you wanted to terminate when you hit Ctrl-F2? – Tim Gage Feb 18 '12 at 14:44
  • I do not understand your argument regarding several processes and the breaking point. Do you imply that when a breaking point is set, then Eclipse has the ability to distinguish between its (own) processes? Setting a breaking point in order to be able to terminate a program execution is bad workaround, what happened when dealing with JAR's, classes, etc. Moreover, when one does not have any idea regarding the program conditional branching, then where should the breaking point be set? – Mr. Feb 18 '12 at 16:27
  • I wasn't suggesting it as a workaround, just trying to explain why it might not do what you expect. I'll try again: You can run/debug several programs at once in Eclipse. When you have an application stopped on a breakpoint you have that specific application focused/selected so Ctrl-F2 kills that application. If instead you've got an application running in the background, when you hit Ctrl-F2, how can Eclipse know which application you want it to terminate? – Tim Gage Feb 18 '12 at 21:49
0

Maybe you have some other plugin command overriding Ctrl+F2 shortcut? Check additional plugins you have installed on your Eclipse.

Sastrija
  • 3,284
  • 6
  • 47
  • 64
Alexey Berezkin
  • 1,513
  • 1
  • 10
  • 18