Eclipse shortcut to run a class

Frank Meulenaar picture Frank Meulenaar · Feb 13, 2010 · Viewed 51.8k times · Source

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

Answer

Verhagen picture Verhagen · Feb 13, 2010
  • 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