Eclipse shortcut to run a class

Viewed 61909

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

12 Answers
  • Open the workspace preferences by the menu: Window > Preferences
  • Select from the tree: Run/Debug > Launching
  • Now the Launching preferences are seen.
  • At the bottom there is Launch Operation
  • Use the option Always launch the previously launched application

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.

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

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

It is Ctrl+F11

Ctrl+Shift+X or Ctrl+Shift+J didn't worked for me!

on Windows machine ctrl+Fn F11 --- running ctrl+Fn+Shift F11 --- debugging

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

  1. Select run from command column
  2. Enter your own shortcut in Binding section
  3. Apply and close!!

WARNING: Make sure you don't create a shortcut which is already assigned for a different task!

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.

Related