Java Eclipse 运行类的快捷方式

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2257692/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 05:20:46  来源:igfitidea点击:

Eclipse shortcut to run a class

javaeclipseshortcutlaunch

提问by Frank Meulenaar

I have an Eclipse project where I often launch the same java class. I have added my run configuration to the favorites menu, but to launch it I still need to click on the run-drop-down menu and click the icon - is there any way to associate a shortcut to this? When I searched for it I got lost in all the plugins & other things which seemed to be not so simple.

我有一个 Eclipse 项目,我经常在其中启动相同的 Java 类。我已将我的运行配置添加到收藏夹菜单中,但要启动它,我仍然需要单击运行下拉菜单并单击图标 - 有没有办法将快捷方式与此相关联?当我搜索它时,我迷失在所有插件和其他似乎不那么简单的东西中。

edit: Let me clarify, I want something I can type the moment I start eclipse, regardless of what page I'm viewing, so no "run last" or "run current"; I want F12 to link to "launch foo.bar.MainClass".

编辑:让我澄清一下,我想要一些我可以在开始日食时输入的内容,无论我正在查看哪个页面,所以没有“最后运行”或“当前运行”;我希望 F12 链接到“启动 foo.bar.MainClass”。

采纳答案by Jherico

You should put in a feature request in the eclipse bug tracker (or vote up an existing equivalent feature request) or code it yourself.

您应该在 eclipse 错误跟踪器中提交功能请求(或投票支持现有的等效功能请求)或自己编写代码。

回答by tangens

You can configure your launch behaviour so Ctrl-F11will launch the last launched application again, regardless of your current editor selection.

您可以配置您的启动行为Ctrl-F11无论您当前的编辑器选择如何,都将再次启动上次启动的应用程序。

Look at "Run/Debug" - "Launching" within the eclipse preferences.

在 Eclipse 首选项中查看“运行/调试”-“启动”。

回答by Verhagen

  • Open the workspace preferences by the menu: Window > Preferences
  • Select from the tree: Run/Debug > Launching
  • Now the Launchingpreferences are seen.
  • At the bottom there is Launch Operation
  • Use the option Always launch the previously launched application
  • 通过菜单打开工作区首选项: Window > Preferences
  • 从树中选择: Run/Debug > Launching
  • 现在Launching可以看到偏好。
  • 在底部有 Launch Operation
  • 使用选项 Always launch the previously launched application

回答by ibrahimyilmaz

alt+shift+x+J Rocks

alt+shift+x+J 摇滚

回答by Faboo03

I cannot this the answer here but : CTRL+SHIFT+T do apparently exactly what you want! :) Maybe it's because you code it by yourself by time...

我不能在这里给出答案,但是:CTRL+SHIFT+T 显然正是您想要的!:) 也许是因为你自己按时间编码...

Watch here: http://eclipse.dzone.com/news/effective-eclipse-shortcut-keyfor more.

在这里观看:http: //eclipse.dzone.com/news/effective-eclipse-shortcut-key了解更多信息。

回答by Dan Ortega

Just use Ctrl + F11. (This is the standard keyboard shortcut to run the class you are working on)

只需使用 Ctrl + F11。(这是运行您正在处理的课程的标准键盘快捷键)

I wish this is what you are looking for... buddy.

我希望这就是你正在寻找的......伙计。

回答by xentaros

If you've added these classes to your favorite run configurations (available from the run/debug toolbar buttons as "Organize Favorites..."), then the shortcut key combo is Alt+R,T,1 to run your first favorite, Alt+R,T,2 to run your second, etc. Alt+R,H,# works for debug configs.

如果您已将这些类添加到您最喜欢的运行配置中(可从运行/调试工具栏按钮作为“组织收藏夹...”获得),那么快捷键组合是 Alt+R,T,1 来运行您的第一个收藏夹, Alt+R,T,2 运行您的第二个,等等。 Alt+R,H,# 适用于调试配置。

回答by Mayur Kharche

I faced this problem in eclipse too. I have customized the configuration for me.

我在 eclipse 中也遇到过这个问题。我已经为我定制了配置。

Windows -> preferances -> keys

Windows -> 首选项 -> 键

Search for your configuration eg "Run Java Application" or just look for its icon.

搜索您的配置,例如“运行 Java 应用程序”或仅查找其图标。

Select it

选择它

and below in the binding field press keyboard keys which you want to add a shortcut for this configuration eg. ctrl + shift + T

并在绑定字段下方按键盘键,您要为此配置添加快捷方式,例如。ctrl + shift + T

and Apply

并申请

You are good to go use the same shortcut keys to whenever you need it.

您可以随时使用相同的快捷键。

回答by Pantelis

You can go Window -> Preferences -> General -> Key and bind anything you want!I hope it helps!

你可以去 Window -> Preferences -> General -> Key 并绑定你想要的任何东西!我希望它有帮助!