IntelliJ IDEA 2016.3 Help

Creating Packages and package-info Files

On this page:

Introduction

Within the folders marked as containing source code (see e.g. Folder categories), the New | Package and New | package-info.java commands are available for creating packages and package-info files.

Creating a package

To create a package, follow these steps:

  1. Open the Project tool window (e.g. View | Tool Windows | Project).
  2. Select the destination folder or package (/help/img/idea/2016.3/rootSource.gif, /help/img/idea/2016.3/rootTest.gif or /help/img/idea/2016.3/iconPackage.png).
  3. Do one of the following:
    • Select File | New | Package.
    • Select New | Package from the context menu.
    • Press Alt+Insert and select Package.
  4. In the dialog that opens, specify the package name. This may be just a name (e.g. helloworld) or a sequence of names separated with dots (e.g. com.example.helloworld). In the latter case, the corresponding package structure will be created.

Creating a package-info.java file

To create a package-info.Java file, follow these steps:

  1. Open the Project tool window (e.g. View | Tool Windows | Project).
  2. Select the package for which you want to create a package-info file.
  3. Do one of the following:
    • Select File | New | package-info.java.
    • Select New | package-info.java from the context menu.
    • Press Alt+Insert and select package-info.java.

See Also

Last modified: 29 November 2016