简体   繁体   中英

Configuring IntelliJ IDEA to create main class for new projects

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.

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.

在资源树中,右键单击要成为主类的类,然后在上下文菜单中应包含“为xyz创建主类”之类的项目。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM