Eclipse中是否有快捷方式重新运行最近启动的程序?

时间:2023-02-05 10:31:11

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].

我用Eclipse做的最常见的事情之一是重新运行最后一个程序。我通过运行 - >运行历史 - > [最*项目]来实现。

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.

我知道CTRL + F11,但这对我不起作用。仅当当前活动的类(我正在编辑其源代码的类)没有main方法时,它才会启动最新的程序。如果是,它将使用此类作为程序的入口点,而不是“运行历史记录”列表中的入口点。

8 个解决方案

#1


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

要使CTRL + F11按您希望的方式工作,您必须将“运行/调试>启动:启动操作”设置(从“Windows /首选项”)设置为:

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:

正如ThorbjørnRavnAndersen在评论中提到的,启动最后一个应用程序曾经是(3.2或之前)的默认行为。自3.3M6(2007年3月)以来,如此线程所示:

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.

这些设置在“运行/调试”>“启动”首选项页面上进行管理。用户还可以恢复到始终启动先前应用程序的3.2行为。


Torsten confirms in the comments:

托尔斯滕在评论中证实:

Pressing F11 only launches the last application in debug mode.

按F11仅在调试模式下启动最后一个应用程序。

#2


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.

运行 - >运行历史 - > [最顶层的项目]只是Alt + R + T + 1.但这种方式的缺点是运行菜单必须只包含一个带有'T'热键的项目。

#3


Yes, Ctrl-F11.

#4


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

对于Scala项目(Scala IDE),我还必须添加它以避免每次都选择Scala lanucher:

  • Run/Debug > Launching > Default Launchers preference
  • 运行/调试>启动>默认启动器首选项

  • in Launch Type/Mode select Scala Application
  • 在启动类型/模式中选择Scala应用程序

  • in Preferred Launcher select Scala Application (new debugger) Launcher
  • 在Preferred Launcher中选择Scala Application(新调试器)启动器

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

这也适用于按Ctrl + F11时打开对话框的其他启动

#5


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

Ctrl + Shift + F9代表具有相同配置的重新启动。

This works out for me!

这对我有用!

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

至少在Pydev-Editor中。我不确定其他观点......

#6


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.

而且你也不需要去Run - > Run History。您只需单击工具栏上“运行”按钮旁边的小向下箭头按钮(这看起来像一个带有白色播放符号的绿色圆圈)。

#7


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

是的,Ctrl + F11在Windows中运行,在Mac中命令+ fn + F11。

#8


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

Ctl + F11对我来说也不起作用(Neon on Lubuntu)。我开始这样做:Alt + r + t + 1

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

也可以使用h而不是t来调试: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

我知道它有点长,但只要我不需要触及鼠标,我可以在任何Linux机器上可靠地做到这一点我很好。此外,通过这种方式,我可以通过更改号码执行最多9次以前的运行

#1


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

要使CTRL + F11按您希望的方式工作,您必须将“运行/调试>启动:启动操作”设置(从“Windows /首选项”)设置为:

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:

正如ThorbjørnRavnAndersen在评论中提到的,启动最后一个应用程序曾经是(3.2或之前)的默认行为。自3.3M6(2007年3月)以来,如此线程所示:

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.

这些设置在“运行/调试”>“启动”首选项页面上进行管理。用户还可以恢复到始终启动先前应用程序的3.2行为。


Torsten confirms in the comments:

托尔斯滕在评论中证实:

Pressing F11 only launches the last application in debug mode.

按F11仅在调试模式下启动最后一个应用程序。

#2


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.

运行 - >运行历史 - > [最顶层的项目]只是Alt + R + T + 1.但这种方式的缺点是运行菜单必须只包含一个带有'T'热键的项目。

#3


Yes, Ctrl-F11.

#4


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

对于Scala项目(Scala IDE),我还必须添加它以避免每次都选择Scala lanucher:

  • Run/Debug > Launching > Default Launchers preference
  • 运行/调试>启动>默认启动器首选项

  • in Launch Type/Mode select Scala Application
  • 在启动类型/模式中选择Scala应用程序

  • in Preferred Launcher select Scala Application (new debugger) Launcher
  • 在Preferred Launcher中选择Scala Application(新调试器)启动器

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

这也适用于按Ctrl + F11时打开对话框的其他启动

#5


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

Ctrl + Shift + F9代表具有相同配置的重新启动。

This works out for me!

这对我有用!

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

至少在Pydev-Editor中。我不确定其他观点......

#6


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.

而且你也不需要去Run - > Run History。您只需单击工具栏上“运行”按钮旁边的小向下箭头按钮(这看起来像一个带有白色播放符号的绿色圆圈)。

#7


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

是的,Ctrl + F11在Windows中运行,在Mac中命令+ fn + F11。

#8


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

Ctl + F11对我来说也不起作用(Neon on Lubuntu)。我开始这样做:Alt + r + t + 1

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

也可以使用h而不是t来调试: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

我知道它有点长,但只要我不需要触及鼠标,我可以在任何Linux机器上可靠地做到这一点我很好。此外,通过这种方式,我可以通过更改号码执行最多9次以前的运行