Как добавить jdk в intellij idea
To start programming in java, the first step is to download the Java SE Development Kit (JDK). You can find this at the java website. Make sure you accept the licence agreement, and download the version for your platform. SE is the Standard Edition. Java also comes in an Enterprise Edition (Java EE), and a micro edition (Java ME).
Note: it is possible to install both 32bit and 64bit JDKs on a 64bit Windows machine. The 64bit JDK is recommended, but some libraries are only available in 32bit, and require the 32bit version, so this can be installed next to the 64bit version.
IntelliJ
To program in Java we’ll use the IntelliJ IDEA, Community edition. This can be found at the jetbrains website. It’s also possible to use the ultimate edition, a licence is available at https://www.jetbrains.com/student/, free for students. We won’t be using any ultimate features through the course though
Creating a TMC account
Create an account on the TMC website. In the Organizational identifier (e.g. student number) field, fill in your student number. Make sure you also fill in your name.
Installing the TMC plugin
After installing IntelliJ and starting it, the first thing should do is setup the TestMyCode plugin. In the startup screen, click on the configure button, and click plugins. On the screen that pops up, search for TMC, then click on the button to search online repositories. Select the TMC plugin, install it and restart IntelliJ. After installing, a new option should appear, Get started with TMC. Click it to fill in your information and select the right course 
Starting up
After TMC is set up, we need to get in the IntelliJ user interface. To get there, we need to make a project. Click Create new Project to open a new project

The first time in this window, the JDK needs to be setup. This is done with the new button at the top of the window, and selecting your JDK. This is usually found in c:\Program Files\java\jdk1.8.0_xxx (where xxx is the version number, 172 at the time of writing). After selecting the Java JDK, press the ‘next’ button on the create new project screen to get into the main screen, where we can pick the first exercise
TMC in IntelliJ
After installing, you will be presented with the TMC login. Login with your login information. Then select the right organization (Haagse Hogeschool), and pick the subject. Make sure this is set up in the settings properly 
After you’re logged in you can download the TMC exercises through the TMC menu, by clicking “Download current course’s ALL exercises”. After downloading, open the TMC exercise list, doubleclick an exercise and you’re ready to go. You can find the sourcecode to work on in the project’s “src” folder.
Configure JDK for testing
To test code using the TMC tests, java has to be added to the system path, so ‘javac’ can be found. If this is not in the path, you will have to add this manually. In order to add this manually, follow the following steps (windows 10)
- Press the windows key, and type Edit environment variables for your account . A popup should appear to edit the environment variables

- In this window, in the User variables section, doubleclick the path item (or add a new one if it’s not there), and a new window will pop up to edit the path variable

- Add the path to your java JDK’s bin directory. This would be C:\Program Files\Java\jdk1.8.0_172\bin for a default java installation, at the time of writing. Please note the version number you’re using
- Press Ok, and restart IntelliJ
IntelliJ features
IntelliJ is a complete working enironment for working with java and contains a lot of advanced features, like autocompletion, refactoring code and a step-by-step debugger. This FAQ will give you some lighlights
Automatic code formatting
To format your code, hit Ctrl + Alt + L
This will format your code to the currently set coding standard. IntelliJ will
- Set curly brackets < and >on the proper lines
- Fix indention
- Fix spaces and tabs
- Remove extra empty lines
It is possible to configure the way IntelliJ reformats your code, this is done in the settings menu (File-Settings or Ctrl + Alt + S), on the Editor — Code Style — Java page.
Automatic error solution suggestions
Sometimes during programming, some errors come up. IntelliJ can fix a lot of these problems by pressing Alt + Enter. A small list will popup with suggestions by IntelliJ to correct the error. This can be used for
- Adding missing imports
- Create non-existing methods or constructors
- Change method parameters
Autocompletion
Autocompletion is often triggered automatically. When it isn’t triggered, you can open it with Ctrl + Space
Some other parts of code can be completed automatically. If you type “sout” and press Tab twice, it will expand to System.out.println
Parameter lookup
To see the parameters in a function, use Ctrl + P. This allows you to easily see what parameters to fill into a function
Creating constructors, getters and setters
By pressing Alt + Insert, you’ll open the Generate menu. In this menu you can pick constructor, getter, setter or override methods. After this a small window pops up where details can be configured, like which parameters to add to the constructor (based on attributes), or what getters and setters to generate.
Renaming
Methods, attributes, variables and classes can be renamed, where all references are also renamed. This can be done through the refactor — rename option, or by pressing Shift + F6
Commenting
You can quickly comment and uncomment multiple lines by selecting the lines you want to comment, and pressing Ctrl + /
Indenting
You can quickly indent multiple lines of code by selecting the lines you want to move left or right, and pressing Tab to move the lines right, or Shift + Tab to move the lines left
Как добавить jdk в intellij idea
A Software Development Kit , or an SDK , is a collection of tools that you need to develop an application for a specific software framework. For example, to develop applications in Java, you need a Java SDK (JDK). SDKs contain binaries, source code for the binaries, and documentation for the source code. JDK builds also contain annotations.
Generally, SDKs are global. It means that one SDK can be used in multiple projects and modules. After you create a new project and define an SDK for it, you can configure modules in this project to inherit its SDK. You can also specify an SDK for each module individually. For more information, refer to Change module SDK.
Supported SDKs
Configure SDKs
To define an SDK means to let IntelliJ IDEA know in which folder on your computer the necessary SDK version is installed. This folder is called an SDK home directory .
Global SDK
From the main menu, select File | Project Structure | Platform Settings | SDKs .
To add an SDK, click , select the necessary SDK and specify its home directory in the dialog that opens.
Only for JDKs: if you don’t have the necessary JDK on your computer, select Download JDK . In the next dialog, specify the JDK vendor, version, change the installation path if required, and click Download .
Project SDK
From the main menu, select File | Project Structure | Project Settings | Project .
If the necessary SDK is already defined in IntelliJ IDEA, select it from the SDK list.
If the SDK is installed on your computer, but not defined in the IDE, select Add SDK | ‘SDK name’ , and specify the path to the SDK home directory.
Only for JDKs: If you don’t have the necessary JDK on your computer, select Add SDK | Download JDK . In the next dialog, specify the JDK vendor, version, change the installation path if required, and click Download .
Module SDK
From the main menu, select File | Project Structure | Project Settings | Modules .
Select the module for which you want to set an SDK and click Dependencies .
If the necessary SDK is already defined in IntelliJ IDEA, select it from the Module SDK list.
If the SDK is installed on your computer, but not defined in the IDE, select Add SDK | ‘SDK name’ , and specify the path to the SDK home directory.
Only for JDKs: If you don’t have the necessary JDK on your computer, select Add SDK | Download JDK . In the next dialog, specify the JDK vendor, version, change the installation path if required, and click Download .
If you want a module to inherit a project SDK, select the Project SDK option from the Module SDK list.

Java Development Kit (JDK)
To develop applications in IntelliJ IDEA, you need a Java SDK (JDK). A 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 is not suitable for application development, as it doesn’t have essential components such as compilers and debuggers.
The bundled JRE is used for running the IDE itself, and it is not sufficient for developing Java applications. Before you start developing in Java, download and install a standalone JDK build.
Due to the changes in the Oracle Java License, you might not have the rights to use Oracle’s Java SE for free. We recommend that you use one of the OpenJDK builds to avoid potential compliance failures.
In IntelliJ IDEA, you can download a JDK package right from the IDE, or you can manually download the necessary JDK distribution and define it in the IDE.
For a manual download, use any available distribution that you like, for example:
If you don’t know which distribution to choose, and you don’t have specific requirements that instruct you to use one of the existing distributions, use Oracle OpenJDK.
Set up the project JDK
From the main menu, select File | Project Structure | Project Settings | Project .
If the necessary JDK is already defined in IntelliJ IDEA, select it from the SDK list.
If the JDK is installed on your computer, but not defined in the IDE, select Add SDK | JDK , and specify the path to the JDK home directory (for example, /Library/Java/JavaVirtualMachines/jdk-12.0.1.jdk ).

If you don’t have the necessary JDK on your computer, select Add SDK | Download JDK . In the next dialog, specify the JDK vendor, version, change the installation path if required, and click Download .
Apply the changes and close the dialog.
If you build your project with Maven or Gradle, refer to Change the JDK version in a Maven project and Gradle JVM selection respectively for more information on how to work with JDKs.
Configure SDK documentation
You can add SDK documentation to IntelliJ IDEA so that you can get information about symbols and method signatures right from the editor in the Quick Documentation popup.
You can also configure external documentation by specifying the path to the reference information online. External documentation opens the necessary information in a browser so that you can navigate to related symbols and keep the information for further reference at the same time.
Specify SDK documentation paths
To view external SDK documentation, configure the documentation URL first.
In the Project Structure dialog Control+Alt+Shift+S , select SDKs .
Select the necessary SDK version if you have several SDKs configured, and open the Documentation Path tab on the right.
Click the icon, enter the external documentation URL, and click OK .
For example, for Java 20, type https://docs.oracle.com/en/java/javase/20/docs/api/ .
Apply the changes and close the dialog.
Access SDK documentation offline
If you work offline, you can view external documentation locally.
Download the documentation package of the necessary version.
The documentation package is normally distributed in a ZIP archive that you need to unpack once it is downloaded.
For example, you can download the official Java SE Development Kit 20 Documentation and unzip it.
In the Project Structure dialog Control+Alt+Shift+S , select SDKs .
Select the necessary JDK version if you have several JDKs configured, and open the Documentation Path tab on the right.
Click the icon and specify the directory with the downloaded documentation package (for example, C:\Users\jetbrains\Desktop\docs\api ).
Setting Up a Java Development Environment on Windows
![]()
In this guide, we’re going to give you the low down on how to set up your machine so that you can develop Java programs. Let’s jump in!
Overview
So, from a high level all you need to do is the following:
- Download and install the JDK (Java Development Kit) — this is the Java platform itself which contains all the tools you need to be able to write and run Java programs
- Set up some environment variables — these let other apps know where yo installed the JDK to and allow Windows to ‘see’ the tools in the JDK so you and other programs can actually use them.
- Download and install an IDE (Integrated Development Environment) — this is the ‘proper application’ you’ll use each day which allows you to type in, edit and run your Java programs.
Whether you’re a highly-experienced Java software engineer working at Google, Facebook or Netflix, or you’re a fresh intern starting out in a bank, these are the tools which all professional Java software engineers have to install once, and use every day to code Java.
Instructions
Downloading and Installing the JDK
Step 1: Find out which version of Windows you have
- Click the Windows Start button, type the first few letters of ‘about’ in the search text box, and click About your PC from the results.
- From the dialog which appears, you’ll be able to see if you have a 32-bit or 64-bit version of Windows. This will be in the About section, labelled as System Type:
The description might not say explicitly, but use this as a guide to work out which one you have:
Step 2: Download the correct JDK for your Windows version
So now you know if you have a 32-bit or 64-bit version of Windows, you can download the JDK which works on your system (i.e. a 64 bit version won’t run on a 32-bit version of Windows etc.)
- Go to your favourite web browser (I hope that’s Google Chrome — that’s mine!), and search for “jdk download”, clicking on the first link which appears if it looks like this:
You’ll end up at the Downloads Page for the JDK on Oracle’s website which is https://www.oracle.com/uk/java/technologies/javase-downloads.html at the time this is written, but is subject to change (which is why we get you to look it up through Google instead).
- Scroll down to the Java SE 8 section (this is the best version for beginners to get started with and is the most popular version currently in industry), and click the JDK Download link:
- You’ll be taken to the page which shows all the different versions of the JDK that can be downloaded. There are versions here for Linux, Solaris, Mac and — right at the bottom (so scroll down again!) — for Windows:
- Click the correct version for your system (you’ll know whether to get the 32- or 64-bit version from the earlier step, remember).
NOTE: you’ll need to accept the agreement and have an account on the Oracle website to download; it’s free to create one and simple to do if you don’t — so create one at this step if you need to, then you’ll be able to download the JDK you selected.
Step 3: Install the JDK you just downloaded
- You can run the installer directly as soon as it has finished downloading (or optionally save the install file first to a directory you want to keep it in and run from there — sometimes it’s nice to keep the installers for applications you install, that’s what I do, but it’s up to you). To do this, click Run. A popup will appear asking if you’re happy for the installer to make changes to your device, click Yes.
- When you go through the installation wizard at this point, you’ll click Next through each page of the installer with one important exception though: change the JDK install location from this screen by clicking Change:
Change the path to a folder which doesn’t contain any spaces: on my Windows systems, I’ll use something like C:\tools where I place all my development tools into — so you might like to choose something similar:
NOTE: Be sure to note this folder path down as you’ll use it later when setting up the environment variables.
Click OK to confirm this and step through the rest of the installation wizard by clicking Next for each step.
Once you’ve done this, the JDK has been installed on your system!
Setting up the Environment Variables
Next up we need to set up two important environment variables:
- Go into Windows Explorer by pressing the Windows key and E ( Win + E ).
- Right-click on the This PC node in the left-hand navigation pane, and select Properties:
- Click the Advanced System Settings link:
- You’re now at the System Properties dialog where you can configure Windows:
- Click the Environment Variables… button to go to the Environment Variables dialog:
This is the screen where we’ll set up our environment variables.
Step 1: Creating the JAVA_HOME environment variable
- In the System Variables section, click the New… button.
- In the pop-up dialog, type the values as follows (adapting the path I have here for the one you noted down when you installed the JDK earlier — if you didn’t do this, you can just flick back to Windows Explorer, navigate to where you downloaded the JDK to, and right-click in the address bar to copy the value, then paste it here instead):
- Click OK when you’re done, and you’ll now see the value defined in the Environment Variables dialog:
Step 2: Adding the JDK tools to the System Path environment variable
Next, we’ll add the tools in the JDK folder, which are located in the bin subdirectory of this) to our System Path.
- From the Environment Variables dialog, click the Path entry in the System Variables pane, then click the Edit… button. You’ll be taken to the edit dialog which allows you to add to the environment variable:
What you’re seeing here is a list of locations where Windows will look in to try and find the programs which correspond to the commands you type from a DOS prompt.
What we need to do now then, is make sure that we add the JDK tools directory to the top of this list — so it becomes the first place Windows will look in (and therefore override the current first entry which is where Windows puts a JRE — this will confuse our development environment, so we override it so the JDK tools we downloaded take precedence over anything shipped with Windows itself — as far as Java is concerned that is (don’t worry — it won’t affect anything besides Java!).
- Click New… and add %JAVA_HOME%\bin — the percentage signs mean "expand to the real value in the environment variable" when Windows looks at it — i.e. it will expand to the actual path you entered before (so this will become something like C:\tools\jdk1.8.0_291\bin when Windows evaluates it when trying to — and successfully being able to — resolve the JDK commands you type in a Dos Prompt).
- Now click Move Up several times until this newly-created entry is at the top of the list:
- Now type the following commands to check your setup:
NOTE: all the versions should show the same as the version of the JDK you downloaded — if they do, you’re good to go! Well done! 😉
Downloading and Installing an IDE
Good news! The IDE is the easiest part of the whole process!
NOTE: Even though we do our actual programming inside this application, it was still important to do the other earlier steps though to ensure our development environment was properly configured since the IDE relies on being able to locate the JDK and the tools inside it (e.g. for compiling your Java code (with the javac command, which is the Java compiler) and being able to run it afterwards (with the java command, which is the Java Virtual Machine).
- Go to the Jetbrains website (Jetbrains is the company which makes the IntelliJ IDEA — this is the IDE we’ll download and install) and click the Download button.
- Go to click the Other Versions on the left underneath the IDEA logo.
NOTE: We’re going to download an older version — the most recent 2018 version. This may seem strange, but in my opinion it’s easier for beginners. Ironically, Jetbrains added some extra features to try and make it easier for beginners, but I personally think they’re too confusing and therefore the version before they added these changes are better for you, so we’ll download this version.
- You’ll be taken to the downloads page:
- Click the link 2018.3.6 — Windows (exe) to download IDEA.
- Once IDEA has downloaded, click Run, agree to the allow changes dialog (like we did earlier for the JDK install), and just accept all default options and click Next throughout the installation wizard.
- Once IDEA has installed successfully, you’ll see the success dialog — click Finish to launch IDEA:
- Select Do Not Import Settings (since you haven’t installed IDEA before), click OK.
- Select the checkbox to agree to the license agreement, click OK.
- Now we’re in the customization dialog, so just click Skip remaining and Set Defaults.
- At this point, you’ll be greeted with the start screen of IDEA:
Well done — you’ve successfully installed IntelliJ IDEA and can now start creating projects and start coding in Java! 😉
Where Next?
If you enjoyed this or prefer to follow along by video, go grab our Java Beginners Starter Kit to jump start your Java journey and learn Java from scratch!
Как установить Java Development Kit

Для разработки на Java должен быть установлен комплект разработчика приложений – Java Development Kit (сокращенно – JDK). Он нужен для запуска, отладки и исполнения программ. Также понадобится IDE – интегрированная среда разработки, в которой вы будете писать код.
Установка JDK
В комплект JDK входит интерпретатор, компилятор, библиотека Java-классов, отладчик, инструменты архивации и сжатия.
Посмотрим, как установить JDK на разные операционные системы.
Windows
Используйте бесплатную версию JDK, которая называется AdoptOpenJDK. Откройте сайт набора и выберите его состав. Например, для Windows подойдет такой набор:
платформа Windows x64 jdk.
После выбора параметров внизу появится ссылка на скачивание набора. Нажмите на нее, чтобы скачать архив на диск.
![]()
Скачанный архив нужно распаковать. Сделайте это в папке C:\Program Files\Java\. При разархивировании внутри появится папка jdk-11 (номер зависит от версии OpenJDK). Внутри нее размещен каталог bin. Полный путь до него – C:\Program Files\Java\jdk-11.0.13+8\bin. У вас путь может быть другим. Он нужен для того, чтобы настроить переменные окружения.
Путь до версии JDK необходимо знать программам, которые будут использовать приложения из набора – например, среде разработки. Чтобы сохранить его в системе, настройте переменную JAVA_HOME:
Нажмите сочетание клавиш Win+R.
В появившемся окне введите «sysdm.cpl» и нажмите «ОК».
Перейдите на вкладку «Дополнительно».
В нижнем правом углу выберите «Переменные среды».
Появится список переменных сред. Нажмите «Создать» и заполните параметры:
Имя переменной – JAVA_HOME.
Значение переменной – C:\Program Files\Java\jdk-11.0.13+8 (укажите путь до папки с JKD на своем компьютере).
Система учитывает регистр. Параметры должны быть такими, как показано выше.
![]()
Найдите в поле «Переменные среды» системную переменную Path. Выделите ее и нажмите «Изменить». Добавьте в PATH путь к каталогу с файлами Java: %JAVA_HOME%\bin. Соблюдайте регистр и не пропускайте символы. После добавления переменных перезагрузите Windows.
После повторного запуска системы проверьте, что JDK установлен. Запустите командную строку и выполните команду:
Если установка прошла успешно, в ответе будет версия JDK.
Linux (Ubuntu 20.04)
В Ubuntu 20.04 по умолчанию входит пакет Open JDK 11. Перед установкой проверьте ранее установленные версии.
Откройте терминал (Ctrl + Alt +T) и выполните команду:
Затем проверьте версию JDK:
Если JDK уже есть, в ответе будет указана версия.
Для запуска приложений на Java нужна среда выполнения – Java Runtime Environment (JRE). Установите ее командой:
Затем установите JDK командой:
Где будет находиться JDK, отдельно указывать не надо. Проверьте версию еще раз:
В ответе должна быть указана версия JDK.
macOS
На macOS для установки JDK используется HomeBrew.
Добавьте в HomeBrew репозиторий с OpenJDK. Откройте терминал (Cmd + N) и выполните команду:
Установите OpenJDK 11:
В ответе должна быть указана версия JDK.
Установка среды разработки для Java
Самая популярная среда разработки для Java – IntelliJ IDEA. В ней есть все необходимое для создания проектов: текстовый редактор, компилятор, отладчик и другие инструменты. У Intellij IDEA есть бесплатная и платная версии. На первое время хватает возможностей бесплатной версии – Intellij IDEA Community Edition.
Windows
Скачайте версию Community для Windows с официального сайта JetBrains.
Запустите скачанный исполняемый файл и выберите путь для установки. По умолчанию это папка ProgramFiles/JetBrains.
Настройте параметры установки. Общие настройки:
64-bit launcher – добавление на рабочий стол ярлыка Intellij IDEA.
Add «Open Folder as Project» – открытие папки с исходниками в редакторе через контекстное меню.
.java – файлы с таким расширением по умолчанию будут открываться через Intellij IDEA.
Выберите папку для ярлыков (по умолчанию) JetBrains. Затем нажмите Install и Finish. Установка InteLLiJ IDEA завершена.
Linux (Ubuntu 20.04)
Установка среды разработки IntelliJ IDEA на Linux проходит даже проще, чем на Windows.
- Откройте «Центр приложений» и введите в поисковой строке слово «Intellij».
- Выберите IDEA Community и нажмите Install.
- После завершения установки откройте список программ.
- Запустите IDEA, примите условия соглашения.
На экране появится стартовое окно. Здесь можно создать или открыть проект.
macOS
На macOS InteLLiJ IDEA установка тоже очень простая.
- Скачайте версию IntelliJ IDEA для macOS с сайта JetBrains. Выберите версию Community.
- Откройте файл с расширением *.dmg. Скопируйте его в «Программы».
- Система выдаст предупреждение. Нажмите «Открыть».
- Примите пользовательское соглашение и нажмите «Продолжить».
Дождитесь завершения установки и запустите IDEA.
Запуск проектов
Среда разработки настроена, все приложения установлены. Осталось разобраться, как запустить JDK c помощью IDEA.
При первом запуске программа просит принять лицензионное соглашение. Затем появляется окно выбора темы – светлой или темной.
Следующий шаг – установка плагинов. Если пока не знаете, что понадобится для разработки, то ничего не меняйте. Если точно знаете, что, например, не будете писать приложения для Android, то удалите плагин Android.
![]()
Не беспокойтесь о составе плагинов. Если что-то забудете или установите лишнее, в любой момент можно будет поправить список в настройках IDEA.
После добавления плагинов появится стартовый экран. Здесь можно создать новый проект, открыть существующий или скачать репозиторий из системы контроля версий.
Создайте новый проект и добавьте в него Java Class – пусть он называется first. Напишите первую программу:
Чтобы запустить первую программу, нажмите Run. Внизу откроется консоль, в которой должно отобразиться приветствие – Hello, world!
Вы только что установили JDK, настроили среду разработки и выполнили первую программу.