Open, close, and move projects
From the main menu, select File and click Open or Recent Projects if you have worked with the project lately.
If you are opening a project for the first time, and this project has several configurations (for example Eclipse and Maven), the IDE will ask you which configuration to load. Refer to Open a project (simple import) for more information on how to open such a project correctly.
Open projects in a new or the same window
By default, when you launch the second or any subsequent project, the IDE asks you how you want to open it: in a new window or in the same window. You can configure the default behavior for such cases in the settings:
In the Settings dialog ( Control+Alt+S ), select Appearance & Behavior | System Settings .
In the Project section, select the necessary Open project in option:
New window : open every project in a separate window.
Current window : close the current project and open a new one in the same window.
Ask : show a dialog with actions to choose from.
Apply the changes and close the dialog.
Always reopen projects
If you quit the IDE having multiple opened projects, they all will be reopened the next time you launch IntelliJ IDEA. If you don’t want to automatically reopen your projects, you can change this behavior in the settings:
In the Settings dialog ( Control+Alt+S ), select Appearance & Behavior | System Settings .
In the Project section, clear the Reopen projects on startup checkbox.
Apply the changes and close the dialog.
Merge project windows (macOS)
On macOS, you can merge all opened project windows into one, turning them into tabs.
Make sure that there are several IntelliJ IDEA projects opened in separate windows.
From the main menu, select Window | Merge All Project Windows .
Drag a project’s tab to work with the project in a separate window again.
Navigate projects on the Welcome screen
If you work with multiple projects, it’s likely that you have a long list of recent projects on the Welcome screen. IntelliJ IDEA provides several options that can help navigate this list in a more convenient way.
You can use the search bar to search for projects, join several recent projects in a group, or set a custom icon for each project.
Group projects
Groups make navigation simpler and help you logically organize your recent projects.
On the Welcome screen, right-click any project and select New Project Group .
In the Create New Project Group dialog, name the new group and click OK .
Right-click the project that you want to move to the new group, select Move to Group , and click the target group’s name.
After that, hover the mouse pointer over the group and use the icon to show the menu from which you can open all projects in the group at once by clicking All Projects in Group . You can also ungroup the projects, move them to another group, and remove them from the list of recent projects at once.

Change the project icon
For each project, you can configure a custom icon so that you can quickly find the necessary project on the Welcome screen. Your custom icon should have the SVG format.
On the Welcome screen, right-click the project for which you want to change an image and select Set Custom Project Icon .
In the dialog that opens, click Choose SVG file and specify the path to the necessary SVG icon.
Click OK to apply the changes.
To remove the custom icon, click in the Set Custom Project Icon dialog.
Switch between projects
If you have several opened projects at the same time, you can switch between them using the following options:
Switch to the next project window: Control+Alt+] ( Window | Next Project Window )
Switch to the previous project window: Control+Alt+[ ( Window | Previous Project Window )
Alternatively, open the Window menu and select the project to which you want to switch.
Change project location
Move a project to another location
In the Project tool window Alt+1 , right-click the root directory of your project and select Refactor | Move directory ( F6 ).
In the dialog that opens, specify a new location for the project and click Refactor .
Change the default location for projects
In the Settings dialog ( Control+Alt+S ), select Appearance & Behavior | System Settings .
In the Default project directory field, specify the path to the folder in which you want to store your projects.
Apply the changes and close the dialog.
Close projects
If you need to close only one project, you can either close the project window or select File | Close Project from the main menu.
If you work with multiple projects, use the following actions to close many projects at once:
Close all projects
From the main menu, select File | Close All Projects .
This action closes all projects that are currently opened in IntelliJ IDEA.
CSE 373, Winter 2019: IntelliJ Project Import Guide
After you’ve obtained the assignment code, there are two possible ways to load that code in IntelliJ: either as a whole project, or as a single module in a project. IntelliJ can only open one project in each window, but each project may have multiple modules.
We recommend importing our code as separate projects, since our assignments contain duplicated files that sometimes confuse IntelliJ, however you may choose to use a single project if you wish; see the bottom of the page for instructions. (Benefits of the single-project workflow include only needing to set our settings for a single project instead of all new projects, and having the ability to view files from all assignments in the same IntelliJ window.)
Importing a new project
This section of the guide covers how to import code as a new project. Note that you should import the project the first time instead of simply opening it. Opening a project will attempt to open it as an existing IntelliJ project, which may cause issues if your partner accidentally commits his/her IntelliJ project files, whereas importing will guarantee that you create a new project. (On the other hand, if you’ve already imported the code on your machine before, you should open the project instead of re-importing it.)
You should also make sure you’re connected to the internet when performing these steps. When you’re importing the project, IntelliJ will automatically try to download any libraries you need to run your code.
Run IntelliJ. If you’re on the welcome screen click «Import Project»:

If you have another project open, click «File» > «New» > «Project from Existing Sources. «:

Navigate to and select the folder containing the code, and then click «OK». There should be a build.gradle file directly inside that folder. (You may also select the build.gradle file instead if using the folder doesn’t work.)
Make sure that «Gradle» is selected on the next screen, then click «Next»

Make sure that «Use auto-import» is checked and that «Use gradle ‘wrapper’ task configuration» is selected, then click «Finish».

What is a ‘gradle project’?
Note: this box contains optional background information: you do not need to know any of the information presented here.
When working on larger projects, programmers tend to face a few different problems:
- How do you keep track of what 3rd party libraries the project needs installed?
- Each IDE stores its project config in a slightly different way. How can you make sure your project can run on all kinds of different IDEs, including ones you’ve never heard of, with minimal fuss?
- Sometimes, building our project and producing a final JAR we can give to our users can require running multiple instructions/performing several complex steps. Instead of having to do that manually, can we just write a script that does this all automatically for us?
It turns out that we can use the same tool to answer all of these questions: a build manager. Basically, what happens is that we record all of the libraries we need, all project configuration, and all build instructions inside of a special file our build manager understands.
Conveniently, it also turns out that all (modern) IDEs have great support for a wide variety of popular build managers: they can read the special file and automatically convert all of those instructions into their IDE-specific configuration.
In our case, we’re using a build manager called «gradle». Try opening up build.gradle inside of your project. If you skim through it, you can see that the file configures a variety of things and specifies a handful of 3rd party libraries we want to install and use. (We’ve commented this file fairly heavily in case you’re curious).
Gradle isn’t the only Java build manager—other popular build managers include Ant, Maven, and Ivy.
If you start working with other programming languages, you’ll learn that they all also have their own build managers and conventions for managing large projects. However, at a high level, they all work in the same way: you specify the libraries you need and your build instructions in some file(s), and run some sort of build tool to manage everything for you.
Single-project workflow
This section of the guide covers how to import code as a new module. Before importing a module, you must first have a project that will contain that module.
Run IntelliJ. If you don’t already have the project that you will be putting your module into, you’ll need to create a new empty project. If you’re on the welcome screen, click «Create New Project»:

If you have a project open but you want to create another new one, click «File» > «New» > «Project. «:

In both cases, you’ll be brought to a new screen to choose the project type. Select «Empty Project»:

Now choose a name and location for the project. The folder you choose does not need to be empty: IntelliJ will just create a .idea folder in your selected location. The location you choose can be the folder that will contain your assignments, or somewhere else entirely; it doesn’t really matter as long as it won’t get deleted or moved, and you can find it later.

If you already have a project that you want to import other modules into, just open that project («Open. » from the welcome screen, or «File» > «Open. » from the editor)
If you’ve just opened the new empty project, IntelliJ should automatically open the «Project Structure» window with the «Module» item selected. If not, open this window from «File» > «Project Structure», then select the «Module» item.
Click the «+» button, then «Import Module»:

Navigate to and select the folder containing the code, and then click «OK». There should be a build.gradle file directly inside that folder. (You may also select the build.gradle file instead if using the folder doesn’t work.)
Make sure that «Gradle» is selected on the next screen, then click «Next»

Make sure that «Use auto-import» is checked and that «Use gradle ‘wrapper’ task configuration» is selected, then click «Finish».
Open Maven & Gradle projects in IntelliJ from Terminal
![]()
Usually we open IntelliJ & import the project from File menu. But how to do the same from your terminal ?
Here is how
Open IntelliJ -> Tools -> Create Command Line Launcher & choose the script name & location & hit OK
Как открыть проект в intellij idea

В прошлой теме мы рассмотрели, как создавать первую программу с последующим ее запуском в командной строке. Однако в реальности, как правило, крупные программы разрабатываются не при помощи простого текстового редактора, а с использованием таких средств как IDE или интегрированные среды разработки, которые упрощают и ускоряют написание кода и создание приложений. На данный момент одной из самых популярных сред разработки для Java является IntelliJ IDEA от компании JetBrains. Рассмотрим, как использовать данную среду.
Прежде всего загрузим установочный дистрибутив с официального сайта https://www.jetbrains.com/idea/download. По этому адресу можно найти пакеты для Windows, MacOS, Linux. Кроме того, сама среда доступна в двух версиях — Ultimate (платная с триальным бесплатным периодом) и Community (бесплатная). В данном случае выберем бесплатную версию Community .

Конечно, Community-версия не имеет ряда многих возможностей, которые доступны в Ultimate-версии (в частности, в Community недоступны опции для веб-приложений на Java). Но Community-версия тоже довольно функциональна и тоже позволяет делать довольно много, в том числе приложения на JavaFX и Android.
После установки запустим IntelliJ IDEA и создадим первый проект. Для этого на стартовом экране выберем New Project :

Далее откроется окно создания проекта. В левой части в качестве типа проекта выберем Java.

Кроме того, в поле Project SDK можно указать путь к Java SDK, который будет использоваться в проекте. Как правило, это поле по умолчанию уже содержит путь к SDK, который установлен на локальном компьютере. Если это поле пусто, то его надо установить.
После этого нажмем на кнопку Next. Далее будет предложено отметить шаблон проекта. По умолчанию тут один шаблон проекта — Command Line App , который предполагает запуск приложения как консольного.

И в конце откроется окно, где надо будет ввести название проекта и пакета, а также указать его расположение на жестком диске. Здесь можно ввести любые данные. Ну в данном случае проект будет называться HelloApp, а базовый пакет «com.metanit».

И после этого для создания проекта нажмем на кнопку Finish. После этого среда создаст и откроет проект.

В левой части мы можем увидеть структуру проекта. Все файлы с исходным кодом помещаются в папку src . По умолчанию она содержит каталог, который называется по имени пакета и который имеет один файл Main.java.
В центральной части программы открыт исходный код программы в виде класса Main. Изменим его следующим образом:
С помощью зеленой стрелки на панели инструментов или через меню Run -> Run запустим проект.
И внизу IntelliJ IDEA отобразится окно вывода, где мы можем увидеть результат работы нашей программы.
Как поместить проект из архива в среду intellij idea?
![]()
Для начала, проект, который упакован в архив, надо распаковать в какое то удобное место. Для IDEA таким местом может быть папка с проектами этой IDE назначенная ей по умолчанию. Далее:
Если этот проект ранее был подготовлен в среде IntelliJ IDEA, то просто открываете его (если в IDE открыт другой проект):
То же самое можно сделать и со стартового экрана IDEA, когда никакой проект еще не открыт: 3-тий пункт — Open:
В появившемся окне указываете путь до корневой папки проекта.
- Если проект подготовлен в другой IDE (написан в блокноте), его надо импортировать, чтобы IDEA могла создать свои рабочие файлы и каталоги:
File -> New -> Project from Existing Sources ..
На стартовом экране это второй пункт — Import Project
В появившемся окне необходимо указать путь до корневой папки проекта. Далее следовать указаниям мастера, так как в зависимости от того, на чем основан проект (Maven, gradle, ant и тд.) требуются разные действия.
Open, close, and move projects
From the main menu, select File and click Open or Open Recent if you have worked with the project lately.
If you are opening a project for the first time, and this project has several configurations (for example Eclipse and Maven), the IDE will ask you which configuration to load. Refer to Open a project (simple import) for more information on how to open such a project correctly.
Open projects in a new or the same window
By default, when you launch the second of any subsequent project, the IDE asks you how you want to open it: in a new window or in the same window. You can configure the default behavior for such cases in the settings:
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Appearance & Behavior | System Settings .
In the Project section, select the necessary Open project in option:
New window : open every project in a separate window.
Current window : close the current project and open the new one in the same window.
Ask : show a dialog with actions to choose from.
Apply the changes and close the dialog.
Always reopen projects
If you quit the IDE having multiple opened projects, they all will be reopened the next time you launch IntelliJ IDEA. If you don’t want to automatically reopen your projects, you can change this behavior in the settings:
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Appearance & Behavior | System Settings .
In the Project section, clear the Reopen projects on startup checkbox.
Apply the changes and close the dialog.
Navigate projects on the Welcome screen
If you work with multiple projects, it’s likely that you have a long list of recent projects on the Welcome screen. IntelliJ IDEA provides several options that can help navigate this list in a more convenient way.
You can use the search bar to search for projects, join several recent projects in a group, or set a custom icon for each project.
Group projects
Groups make navigation simpler and help you logically organize your recent projects.
On the Welcome screen, right-click any project and select New Project Group .
In the Create New Project Group dialog, name the new group and click OK .
Right-click the project that you want to move to the new group, select Move to Group , and click the target group’s name.
After that, hover the mouse pointer over the group and use the icon to show the menu from which you can open all projects in the group at once by clicking All Projects in Group . You can also ungroup the projects, move them to another group, and remove them from the list of recent projects at once.

Change the project icon
For each project, you can configure a custom icon so that you can quickly find the necessary project on the Welcome screen. Your custom icon should have the SVG format.
On the Welcome screen, right-click the project for which you want to change an image and select Change Project Icon .
In the dialog that opens, click Choose SVG file and specify the path to the necessary SVG icon.
Click OK to apply the changes.
To remove the custom icon, click in the Change Project Icon dialog.
Switch between projects
If you have several opened projects at the same time, you can switch between them using the following options:
Switch to the next project window: Ctrl+Alt+] ( Window | Next Project Window )
Switch to the previous project window: Ctrl+Alt+[ ( Window | Previous Project Window )
Alternatively, open the Window menu and select the project to which you want to switch.
Change project location
Move a project to another location
In the Project tool window Alt+1 , right-click the root directory of your project and select Refactor | Move directory ( F6 ).
In the dialog that opens, specify a new location for the project and click Refactor .
Change the default location for projects
In the Settings/Preferences dialog ( Ctrl+Alt+S ), select Appearance & Behavior | System Settings .
In the Default project directory field, specify the path to the folder in which you want to store your projects.
Apply the changes and close the dialog.
Close projects
If you need to close only one project, you can either close the project window or select File | Close Project from the main menu.
If you work with multiple projects, use the following actions to close many projects at once:
Close all projects
From the main menu, select File | Close All Projects .
This action closes all projects that are currently opened in IntelliJ IDEA.