IntelliJ IDEA

Introduction

IntelliJ is the most popular IDE for Java, from the Russian company JetBrains

Download IntelliJ

Download from the site JetBrains.com

IntelliJ IDEA image from website www.aredel.com
IntelliJ

Create a new project

File → New… → Project

IntelliJ IDEA File New Project image from website www.aredel.com
IntelliJ

Choose the required SDK.

IntelliJ IDEA New Project, choosing Project SDK, image from website www.aredel.com
IntelliJ

My system has three of them; I used the 14th last time, and IntelliJ remembered it.

The eighth Java is currently configured in Path and there is also a 16th, but I have not exposed it anywhere; it is just unpacked into Program Files

In the left column you have to choose how you want to build the project.

To begin with, choose just Java

IntelliJ IDEA image from website www.aredel.com
IntelliJ

To avoid setting everything up by hand, create a project from a template.

After the first installation the Command Line App template is available, choose it

IntelliJ IDEA image from website www.aredel.com
IntelliJ

Make up a name for the project and the package.

The package name is usually the reverse of the domain (or an imaginary domain)

If I were making a project for the site topbicycle.ru the package would be called ru.topbicycle

IntelliJ IDEA image from website www.aredel.com
IntelliJ

The empty project hw1 consists of:

First run

The first thing to do is to run

Build → Rebuild Project

IntelliJ IDEA image from website www.aredel.com
IntelliJ

If you get

Process finished with exit code 0

then all is well and you can carry on.

Increase the font size

Once the project is created, I recommend opening the settings File → Settings and changing the font size to one that is comfortable for you.

It has to be changed in two places: Appearance and Editor

To start writing code, right-click on src → New → Java Class

IntelliJ IDEA image from website www.aredel.com
IntelliJ

If when creating the project you choose Maven

IntelliJ IDEA image from website www.aredel.com
IntelliJ

Give the project a name

IntelliJ IDEA image from website www.aredel.com
IntelliJ

Choose how to open the new project: instead of the current one (This Window) or in a new window (New Window)

If you chose Maven project, the following will be created: the pom.xml file

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.homework</groupId> <artifactId>hw1</artifactId> <version>1.0-SNAPSHOT</version> </project>

C:\dev\tools\java-se-8u41-ri\bin\java.exe "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.1\lib\idea_rt.jar=21504:C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2020.2.1\bin" -Dfile.encoding=UTF-8 -classpath C:\dev\tools\java-se-8u41-ri\jre\lib\charsets.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\cldrdata.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\dnsns.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\localedata.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\nashorn.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\sunec.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\sunjce_provider.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\sunmscapi.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\sunpkcs11.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\ext\zipfs.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\jce.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\jsse.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\management-agent.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\resources.jar;C:\dev\tools\java-se-8u41-ri\jre\lib\rt.jar com.andrei.homework.Main Error: Could not find or load main class com.andrei.homework.Main Process finished with exit code 1

The first thing to try is

Build → Rebuild Project

Article author: Andrei Olegovich