On this page:
Creating Java files in Kotlin projects
- Create a Kotlin project as described in the sections Creating Kotlin-JVM Project or Creating Kotlin-JavaScript Project.
- In the Project tool window, select the target package or directory, where you want the Java class to be created.
- Press ⌘N, ⌃⏎, ⌘N or ⌃⏎⌃N, ⌃⏎, ⌃N or ⌃⏎⌘N, ⌃⏎, ⌘N or ⌃⏎^ N, ⌥ Insert, ⌃N or ⌃N⌥ Insert, choose Java Class from the pop-up menu, select its kind, and specify its name. See Creating Java Classes, Interfaces, Enumerations and Annotations.
Creating Kotlin files in Java projects
- In a Java project, select the target location, press ⌘N, ⌃⏎, ⌘N or ⌃⏎⌃N, ⌃⏎, ⌃N or ⌃⏎⌘N, ⌃⏎, ⌘N or ⌃⏎^ N, ⌥ Insert, ⌃N or ⌃N⌥ Insert and choose Kotlin file from the pop-up menu.
- If this is first time you create a Kotlin file in a Java project, the banner shows:

Click the link Configure, and select the desired configurator:

In the dialog box Create Kotlin Java Runtime Library that opens, do the following:
- Choose the modules to configure (if there are several modules in a project)
- Specify which Kotlin run-time library should be used.

Note that in the future the configuration action is not required.
