Skip to content

When creating a Java class in IntelliJ: is there a wizard/menu to select the package and class to extend from?

One of the features I like of Eclipse is that when creating Java classes, a wizard is available to specify different properties for the class. Like its package, class to extend from…etc (see below in the screen cap).

Eclipse new Java class menu

Does IntelliJ provide something similar? I created a class but the process wasn’t smooth. I had to…mark /java directory as Source Root…create new package…create a new class…and now, I want to extend from a different class other than Object… I would like to avoid doing this step by step, if possible.

I am using IntelliJ Community Edition, version 15.

Answer

No, there is no such wizard. Marking the directory as a source root is a one-time action, and is normally taken care of when you create the project. To specify the package, you can enter the package and class name directly in the “New Java class” dialog. If you want to extend a different class, the code completion will help you enter the “extends” or “implements” keyword and specify the base class name.