Skip to lesson

Set up IntelliJ IDEA for Java

I'm on:

Showing steps for Windows. They are marked “On Windows” below.

Pick one IDE – you only need one. VS Code, IntelliJ IDEA and Eclipse are alternatives for this step: finish any one of them and the step is done. This guide sets up IntelliJ IDEA.

Install IntelliJ IDEA

An IDE (Integrated Development Environment) is an app where you write, run and fix code in one window. It shows mistakes as you type and runs your program with one click.

IntelliJ IDEA by JetBrains is a popular Java IDE. One download includes the free Java features this course needs; skip any trial of advanced features. Install the JDK first (Install Java (opens in a new tab)).

On Windows

Open the Download IntelliJ IDEA page using the button above and choose Windows.

  1. Click Download. You get an installer (.exe).
  2. Double-click the .exe file. If Windows asks for permission, click Yes.
  3. On Installation Options, tick Create Desktop Shortcut. You can also tick Add "bin" folder to the PATH.
  4. Click Install, then Finish. Open IntelliJ IDEA from the Start menu or the desktop.
Older guides talk about choosing a Community Edition. Since version 2025.3, IntelliJ IDEA is one download, so there is nothing to choose.

Create a new Java project

A project is a folder that holds all the files of one program.

Add sample code makes a ready Main class for you. Untick it here, because you will make the class yourself and see each step.

  1. On the Welcome screen, click New Project.
  2. On the left, choose Java. Type the name HelloApp.
  3. Set Build system to IntelliJ.
  4. In the JDK dropdown, choose the JDK you installed. If the list is empty, choose Download JDK.
  5. Untick Add sample code, then click Create.

On Windows

IntelliJ saves projects in the IdeaProjects folder, for example C:\Users\<you>\IdeaProjects\HelloApp. You can change the Location box if you like.

Create a class and run Hello World

IntelliJ has short codes that type common lines for you: psvm makes the main method and sout makes a print line. This is the class you will make:

Main.javaJava
public class Main {    public static void main(String[] args) {        System.out.println("Hello, World!");    }}
Output
Hello, World!

Follow these steps to type it with the short codes, then run it.

  1. In the Project panel on the left, right-click the src folder → New → Java Class.
  2. Type Main and press Enter. IntelliJ makes Main.java.
  3. Inside the class, type psvm and press Tab. The main method appears.
  4. Inside main, type sout and press Tab. Then type "Hello, World!" inside the brackets.

On Windows

Now run the program.

  1. Click the green ▶ next to main and choose Run 'Main.main()'. Or press Ctrl + Shift + F10.
  2. The output appears in the Run window at the bottom.
  3. To run it again later, press Shift + F10.
These shortcuts use IntelliJ's default Windows and macOS keymaps. If a shortcut does nothing, click the green ▶ next to main instead.

Common problems and fixes

Most problems come from a missing JDK or a name that does not match.

  • Wrong class name – public class Main must be in Main.java. To rename, right-click the file → Refactor → Rename (Shift + F6), so the file and class change together.
  • No green ▶ next to main – check that the line is exactly public static void main(String[] args) and that the file is inside src.

On Windows

Problems seen on Windows:

  • "No JDK selected" or "Project JDK is not defined" – click Setup SDK in the yellow bar, or open File → Project Structure (Ctrl + Alt + Shift + S) and choose your JDK.
  • IntelliJ does not list your JDK – in Project Structure, open the SDK dropdown, choose Add JDK from disk (or Add SDK → JDK) and pick your real JDK folder, for example C:\Program Files\Java\jdk-25 (Oracle) or the folder inside C:\Program Files\Eclipse Adoptium (Temurin).

Example

Main.javaJava
public class Main {    public static void main(String[] args) {        System.out.println("Hello, World!");    }}
Output
Hello, World!

What this code does

  • psvm + Tab typed the main line, and sout + Tab typed System.out.println();.
  • The class is Main, so the file is Main.java.
  • In the Run window you also see Process finished with exit code 0. It means the program ended without errors.

Next step

Practice what you learned

2 small exercises