I have just started learning Java using an online course. When I create a new project with IntelliJ, I don't have the Main class in the src folder. However, the instructor is saying IntelliJ should create the class "Main" by default.

HOW I SHOULD HAVE IT:

-"Name of the project"
  -Idea
  -src
      -"com.myname"
          -Main (the Class)

HOW I HAVE IT:

-"Name of the project"
  -Idea
  -src (which contains nothing)

Therefore, I have to create manually the class "Main" by clicking on "src" and creating a class named "Main" with this code inside:

Public class Main {

    public static void main(String[] args) {

    }

}

MY QUESTION: how can I set IntelliJ to automatically create the main class every-time a new create a new project?

Many thanks for your help.


从模板创建项目:

模板

命令行应用程序将添加一个带有空main方法的类。


FYI, eventually you may want to learn about defining your project with Apache Maven. Maven is supported directly by all of the Big Three IDEs (IntelliJ, NetBeans, Eclipse).