Configuring IntelliJ IDEA to create main class for new projects

12,837

I don't know if Settings->File Templates is what you have in mind, but I'll point it out just in case.

You can easily create a class and add a main method by typing "psvm " and filling in the method body. You run it by right clicking on the class and selecting "Run". It's automatically be added to your Run/Config list, you just have to save it to make it permanent.

But my gut feeling is that IntelliJ has no such a feature for reading somebody's mind about a "default main class", nor should it.

Share:
12,837
ripper234
Author by

ripper234

See blog or LinkedIn Profile

Updated on June 05, 2022

Comments

  • ripper234
    ripper234 almost 2 years

    A friend is just starting to learn Java, using IntelliJ. He asks how can he set up some template so creating a new project will contain a default main class.

    Currently, when he creates a new project, it has no source files, and he has to add a Run/Debug application configuration manually, and then select the main class.