Magofoco
Magofoco

Reputation: 5476

IntelliJ - Java Main Class is missing when I create a new project

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.

Upvotes: 2

Views: 2208

Answers (1)

CrazyCoder
CrazyCoder

Reputation: 402581

Create the project from template:

template

Command Line App will add a class with the empty main method.

Upvotes: 3

Related Questions