Run current file in IntelliJ?

I recently tried switching from Eclipse to IntelliJ as a debugger for my university course, and I really like automatic completion, Chronon debugging, and other nice features. But there is one thing that drowns me out with living hell: I just want to run the current file!

In Eclipse, the Run button was smart enough to just run the current file if it contains the main method and otherwise use the file with the last run. But in IntelliJ, just running a file is much more complicated. You need to create the "Run configuration" of the desired file, and then select "Run configuration", and not just open the desired file. This is a big problem for me, especially since I have many different classes with basic methods in most homework and projects.

I found that on Macs, Ctrl + FN + Shift + F10 would be “Run context configuration”, which is almost what I'm looking for. But for some reason, this key binding does not have an equivalent button on the toolbar that switches to the context configuration and launches it, which would solve all my problems! Can anyone help me out?

+5
source share
4 answers

If you hover over the Run and Debug buttons, you will see shortcuts. Given that you are on Mac OS and Fn it is important to call the F buttons here, shortcuts:

Run : Shift + Fn + F10

Debugging : Shift + Fn + F9

+4
source

I can not find the action "Run the current file, otherwise the selected context". I found them separately.

The key is associated for "Run the current file":

  • Run context configuration
  • Debug Context Configuration
+5
source

By default, the Run and Debug buttons launch the latest configuration. If you want to run the current file, right-click in the editor and you will see entries for running or debugging the current file.

On Windows, I have Alt + Shift + F6 for starting a Java or JS file and Ctrl + Shift + F5 for debugging (using the Netbeans layout).

0
source
Answer

@dimitrisli was partially correct. In fact, if you want to run the current script, you need to use: CONTROL + FN + SHIFT + F10

FN + SHIFT + F10 => starts the last execution (but if you add CONTROL, it will run the current script if the file has the main method or is a test class).

0
source

Source: https://habr.com/ru/post/1205928/


All Articles