Reputation: 9117
I'm looking for a shortcut that will allow me to build and run a project in Java that is currently opened.
There is a shortcut like this: ⌘+⌥+x and then j but it only works if there is a public static void main()
method delacred in the currently viewed file.
Is there a shortcut that can be used no matter which file of the project you want to run is currently opened?
Upvotes: 1
Views: 1497
Reputation: 32905
That key combination will work for the whole project only if the focus/selection is on a project in Package Explorer or Project Explorer.
Alternatively, you can re-launch the last program (or test), regardless of where your focus is, using the Run Last Launched command:
Windows: Ctrl+F11.
Mac: ⇧+⌘+F11 or ⇧+⌘+fn+F11 (depending on your settings of the function keys).
That's a reasonable alternative if you find yourself repeatedly running the same program or test.
Upvotes: 2