When you create a new project, you have to select a project type, configure an SDK, and specify the project name and location.
You can also specify the necessary settings right in the New Project wizard, so that when you open your project for the first time, it will be pre-configured. For example, the IDE will load libraries and create files. In case of Maven or Gradle, IntelliJ IDEA will define tasks and declare dependencies.
Configure the JDK when creating a project
To develop applications in IntelliJ IDEA, you need the Java SDK (JDK). The JDK is a software package that contains libraries, tools for developing and testing Java applications (development tools), and tools for running applications on the Java platform (Java Runtime Environment — JRE).
The JRE can be obtained separately from the JDK, but it's not suitable for application development, as it doesn't have essential components such as compilers and debuggers.
IntelliJ IDEA doesn't come with the JDK, so if you don't have a necessary JDK version, you must download and install it.
Open the jdk.java.net website.
There, you'll find the Oracle's OpenJDK binaries for Windows, macOS, and Linux as .tar.gz and .zip archives.
Select and download the necessary JDK version.
If you're not sure which version you need, select the latest stable version.
Unzip the archive and place the folder with Java to a meaningful location, for example: /Library/Java/JavaVirtualMachines on macOS or to C:\Program Files\Java on Windows.
Launch IntelliJ IDEA.
If the Welcome screen opens, click Create New Project.
Otherwise, from the main menu, select.
Next to Project SDK, click New and specify the path to the Java home directory (for example, jdk-11.0.0.jdk).
For information on how to configure a JDK for an existing project, refer to Define an SDK.
In IntelliJ IDEA, there are two types of formats in which a project's configuration can be stored — the file-based format format (legacy) and the directory-based format (default and recommended).
For file-based projects, the IDE creates the .ipr, .iws and .iml files. For projects stored in the directory-based format, the IDE creates the.iml file and the .idea directory that keeps project settings.
The .iml file is created for each module in a project. For more information, refer to Working with modules.
Change the project format
If you want to change the project's format to directory-based, go to.
Import a project
To import a project in IntelliJ IDEA, go to.
In IntelliJ IDEA, you can import a project that comes from Eclipse and Flash Builder. You can also import a collection of source files to create a new project from them.
If you're importing a project that uses build tools such as Maven or Gradle, it's recommended that you import the associated build file (pom.xml or build.gradle). In this case, IntelliJ IDEA will recognize the dependencies and artifacts in the project, and will automatically restore their configuration.
For Maven and Gradle projects, consider enabling the Store generated project files externally option in the project import dialog if you share the project through VCS.
Usually, IntelliJ IDEA recreates the .iml file every time you make changes in the descriptor file and these changes get imported. You can avoid placing the .iml file under version control, but in this case some changes in the module configuration won't be shared (such as added facets, for example). With the Store generated project files externally option on, generated files will be stored separately, and you won't have to exclude files from version control.
Project structure settings
For projects in IntelliJ IDEA, you can configure a name, specify an SDK, set a language level and a compiler output. To change project settings, go to Project.or press Ctrl+Shift+Alt+S, and select
Not that the changes will only be applied to the current project. If necessary, you can configure a global SDK, language level and compiler output that will be applied to all newly created projects. To change global project settings, go to.
Share project settings through VCS
Project settings are stored in the project directory as a set of XML files under the .idea folder. This folder contains both user-specific settings that shouldn't be placed under version control and project settings that are normally shared among developers working in a team, for example, the code style configuration.
When you place a project under version control, your personal settings are automatically ignored. IntelliJ IDEA moves workspace.xml – the file with your personal settings – to the list of ignored files to avoid conflicts with other developers' settings.
Configuration files are processed according to your choice. Once you modify the project settings, and a new configuration file is created, the IDE shows a notification at the bottom of the screen prompting you to select how you want to treat configuration files in this project:
View files: view the list of created configuration files and select, which of them you want to place under version control. After that, the selected files will be scheduled for addition to VCS.
Always Add: silently schedule all configuration files created in the .idea directory for addition to VCS (applies only to the current project).
Don’t Ask Again: never schedule configuration files for addition to VCS; they will have the unversioned status until you manually add them to VCS (applies only to the current project).
If you close the notification without selecting any option, it will appear again after a new configuration file is created. The new file will also go to the list that will be there until you select one of the options even if you restart the IDE.
Copy global settings to the project level
Global (IDE) settings are stored separately from projects. That is why, these settings are not shared through version control.
Some settings, however, can be copied to the project level. For example, you can create a copy of your code style configuration, inspection profiles, the list of classes and packages excluded from code completion and auto-import. If you do so, the IDE creates the corresponding configuration files in the .idea directory that you can share together with the project through VCS.