views:

796

answers:

2

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.

+2  A: 

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.

duffymo
Thanks, the first part of your answer helped, not sure what you meant in the last one.
ripper234
if i'm writing a web app, what do i care about a main class that runs in a command shell? your friend who's learning java and intellj, focusing on desktop stuff, is a special case.
duffymo
A: 

Intellij doesn't need to "read my mind" it just needs to let me select a project type that would set up a command line program.

For web apps it creates a structure with an src dir output dir etc. It would be nice if they would do the same for desk top apps (some of those are still needed ;) ).

KingAndrew