javaeclipseintellij-idea

Run the current file in IntelliJ?


I've recently tried to switch from Eclipse to IntelliJ as a debugger for my university course, and I'm really enjoying the auto-completion, Chronon backwards debugging and other nice features. But there's one thing that bugs the living hell out of me: I just want to run the current file!

In Eclipse, the "Run" button was intelligent enough to simply run the current file if it contained a main method, and use the last-ran file otherwise. But in IntelliJ, just running a file is much more complicated. You have to create a Run Configuration of the right file, and then select that Run Configuration, instead of just opening the file you want. This is a big hassle for me, especially since I have many different classes with main methods in most homeworks and projects.

I found that on Macs, Ctrl + FN + Shift + F10 will "Run Context Configuration", which is almost what I'm looking for. But for some reason, this key binding doesn't have an equivalent toolbar button that switches to the context configuration and just runs it, which would solve all my problems! Can anyone help me out?


Solution

  • Years later, the simple answer: Right click inside the file and hit "Run"!