Within the folders marked as containing source code (see e.g. Folder categories), the and commands are available for creating packages and package-info files.
Creating a package
- Open the Project tool window (e.g. ).
-
Select the destination folder or package
(
,
or
). -
Do one of the following:
- Select .
- Select from the context menu.
- Press ⌘N, ⌃⏎, ⌘N or ⌃⏎⌃N, ⌃⏎, ⌃N or ⌃⏎⌘N, ⌃⏎, ⌘N or ⌃⏎^ N, ⌥ Insert, ⌃N or ⌃N⌥ Insert and select Package.
-
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
- Open the Project tool window (e.g. ).
- Select the package for which you want to create a package-info file.
-
Do one of the following:
- Select .
- Select from the context menu.
- Press ⌘N, ⌃⏎, ⌘N or ⌃⏎⌃N, ⌃⏎, ⌃N or ⌃⏎⌘N, ⌃⏎, ⌘N or ⌃⏎^ N, ⌥ Insert, ⌃N or ⌃N⌥ Insert and select package-info.java.
You can edit the template for package-info.java in the Preferences dialog
on the File and Code Templates page.