Eclipse: How to make Ctrl+F11 work no matter which file is being edited

configurationeclipseidekeyboard shortcuts

Ctrl + F11 is the "Run" keyboard shortcut in Eclipse.

But for me, that only works if a Main class is active in the editor. For any of the other 100+ java files in my workspace, eclipse pops up a dialog, complaining "Editor does not contain a main type".

This makes the Ctrl + F11 shortcut nearly useless. I either have to press Ctrl + Alt + T, name of main class, Ctrl + F11, or use the mouse.

Do I have something misconfigured? What can I do to make Ctrl + F11 really run my program, no matter which file is active in the editor? Or is everybody using the Ctrl + F11 shortcut like that?

edit: I'm using eclipse 3.5.0

Best Answer

You can configure Eclipse to always use the previously launched application: Window → Preferences → Run/Debug → Launching → Always launch the previously launched application. This almost always does what you want.