149

One of the most frequent thing I do with Eclipse is to re-run the last program. I do it by going to Run -> Run History -> [top most item].

Is there a shortcut key that does this?

I know of CTRL + F11 but this does not work for me. It will launch the most recent program only if the currently active class (the class whose source code I am editing) does not have a main method. If it does it will use this class as the entry point for the program and not the one from the Run History list.

Uooo
  • 6,204
  • 8
  • 36
  • 63
Itay Maman
  • 30,277
  • 10
  • 88
  • 118

9 Answers9

232

For CTRL+F11 to work the way you want, you must set (from "Windows/Preferences") the
"Run/debug > Launching : Launch Operation" setting to:

Always launch the previously launched application


As Thorbjørn Ravn Andersen mentions in the comment, launching the last app used to be (3.2 or before) the default behavior.
Since 3.3M6 (March 2007), As illustrated by this thread:

By default, running and debugging applications has been simplified to run or debug the selected file or active editor.
When the selected resource (or active editor) is not executable, users can opt to launch the associated project or re-launch the previous launch.

These settings are managed on the Run/Debug > Launching preference page.
Users can also revert to the 3.2 behavior of always launching the previous application.


Torsten confirms in the comments:

Pressing F11 only launches the last application in debug mode.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • 16
    This is actually the historic behaviour of Ctrl-F11. Shame on those who changed. – Thorbjørn Ravn Andersen Jul 20 '09 at 10:09
  • 3
    The new behaviour is optimal for beginners that write a single executable class. The old approach is optimal for large tasks with multiple projects that may have several entry points. – Audrius Meškauskas Jun 14 '13 at 07:09
  • 3
    Thanks, and for mac user it's Command+F11 (often the function buttons are not enabled by default so this is essentially Command+fn+F11) – gerrytan Nov 23 '13 at 03:31
  • If you need both behaviors, assign a simple key for launching current program, currently launched by alt+shift+x+ combination. For Java, I set Alt+j (assigned to join lines by default) – Paddy Dec 22 '14 at 15:03
  • This seems to only launch run and not debug, is that the case for you? Can F11 for debug be configured similarly? – Noumenon Feb 26 '17 at 15:18
  • 1
    @Noumenon 8 years later, not too sure. I remember it should launch the last operation. So if the last session was a debug one, it should re-launch a debug session. – VonC Feb 26 '17 at 15:23
  • @VonC No need for doubts: Pressing F11 only launches the last application in debug mode. If you have the settings above, it behaves similarly as ctrl + F11. – Torsten Nov 17 '17 at 14:44
  • @Torsten Thank you. I have included your comment in the answer for more visibility – VonC Nov 17 '17 at 14:50
17

Run -> Run History -> [top most item] is just Alt + R + T + 1. But downside of this way is that Run menu must contain only one item with 'T' hot-key.

æ-ra-code
  • 2,140
  • 30
  • 28
5

Yes, Ctrl-F11.

Bombe
  • 81,643
  • 20
  • 123
  • 127
2

For Scala projects (Scala IDE) I had to also add this to avoid selecting a Scala lanucher every time:

  • Run/Debug > Launching > Default Launchers preference
  • in Launch Type/Mode select Scala Application
  • in Preferred Launcher select Scala Application (new debugger) Launcher

This also works for other launches that open a dialog when you press Ctrl+F11

Eran Medan
  • 44,555
  • 61
  • 184
  • 276
2

Ctrl+Shift+F9 stands for Relaunch with the same configuration.

This works out for me!

At least in Pydev-Editor. I'm not sure about the other perspectives...

sina72
  • 4,931
  • 3
  • 35
  • 36
Mutabor
  • 86
  • 1
  • 4
1

Ctrl-F11

And also you don't need to go to Run --> Run History. You can just click the small down arrow button next to the Run button (This looks like a green circle with a white play symbol in it) on your toolbar.

Sajal Dutta
  • 18,272
  • 11
  • 52
  • 74
  • 6
    Yes, but when you're in the zone, keyboard works faster than a mouse – Itay Maman Jul 20 '09 at 07:02
  • Exactly. Set the CTRL-F11 properly. – Sajal Dutta Jul 20 '09 at 08:42
  • I am currently editing my JUnit test and I only want to run the test method I am writing. I do that by highlighting the method name first -> I do this every I time I want to run. So I googled for a shortcut for running the most recent run. I think this is a proper case where we need a separate shortcut for the most recent run – thirdy Feb 13 '12 at 01:28
0

Yes, Ctrl + F11 works in Windows and command + fn + F11 in Mac.

0

Ctl + F11 did not work for me either (Neon on Lubuntu). I started doing this: Alt + r + t + 1

One could also use h instead of t to debug: Alt + r + h + #

I know it's a little longer but as long as I do not have to reach for the mouse and I can do it reliably on any Linux machine I am fine. Also, this way I can execute up to 9 previous runs by changing the number

ObviousChild
  • 119
  • 1
  • 9
0

Way One:

Click the project from of this icon at this time hold the shift Button, Project will restart (Terminate and relaunch) with server port also.

enter image description here

Way Two:

enter image description here:

From of Eclipse Menu Bar: Windows => Preferences => Type and select keys type filter tex: terminate and relaunch Bind your Shortcut Key Like this:

Imranmadbar
  • 4,681
  • 3
  • 17
  • 30