How to add by default Static void main?


Like in Eclipse, when we create the new class, there is the option to add Static void main line, the same way, how can I add this to IntelliJ Java CE whenever create the new class?

Comment actions Permalink

You can edit Class file template and add a method there or create a new template like Class with Main.

Or just type "psvm" and press Tab after creating a class.

Comment actions Permalink

Thanks psvm works fine.

Comment actions Permalink

You can also check this site if you want to set psvm up as part of your java class template:

Pretty much you have to go to File/ Settings/ Editor/ File and Code Templates, then select Class from the list of files and include in the code the psvm structure:

public static void main (String[] args) {


Hope it was helpful! :)


Please sign in to leave a comment.