Reputation: 1209
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.
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".
Upvotes: 30
Views: 69664
Reputation: 1
Just create an "External tool configuration" instead of a standard configuration for the class you want to run, and assign a shortcut key to "Run last launched external Tool".
Of course, there shall be no other external tool configuration.
Even if other java programs have been launched, or the current class contains a main() method, hitting the shortcut key will always run the same configured class.
Upvotes: 0
Reputation: 11
If you are someone like me who wants to create a shortcut to run a class/program in java directly, you can create your own preferable shortcut in ECLIPSE!
Follow these steps:
Window
> Preferences
> General
> Keys
command
columnBinding
sectionWARNING: Make sure you don't create a shortcut which is already assigned for a different task!
Upvotes: 1
Reputation: 31
It is Ctrl+F11
Ctrl+Shift+X or Ctrl+Shift+J didn't worked for me!
Upvotes: 3
Reputation: 11
on Windows machine ctrl+Fn F11 --- running ctrl+Fn+Shift F11 --- debugging
Upvotes: 1
Reputation: 41
You can go Window -> Preferences -> General -> Key and bind anything you want!I hope it helps!
Upvotes: 4
Reputation: 717
I faced this problem in eclipse too. I have customized the configuration for me.
Windows -> preferances -> keys
Search for your configuration eg "Run Java Application" or just look for its icon.
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
and Apply
You are good to go use the same shortcut keys to whenever you need it.
Upvotes: 0
Reputation: 4034
Window > Preferences
Run/Debug > Launching
Launching
preferences are seen.Launch Operation
Always launch the previously launched application
Upvotes: 31
Reputation: 11
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.
Upvotes: 1
Reputation: 1899
Just use Ctrl + F11. (This is the standard keyboard shortcut to run the class you are working on)
I wish this is what you are looking for... buddy.
Upvotes: 33
Reputation: 43
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...
Watch here: http://eclipse.dzone.com/news/effective-eclipse-shortcut-key for more.
Upvotes: 0
Reputation: 29240
You should put in a feature request in the eclipse bug tracker (or vote up an existing equivalent feature request) or code it yourself.
Upvotes: 3
Reputation: 39733
You can configure your launch behaviour so Ctrl-F11 will launch the last launched application again, regardless of your current editor selection.
Look at "Run/Debug" - "Launching" within the eclipse preferences.
Upvotes: 26