Set up IntelliJ IDEA for Java
20 min · Beginner
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 is a popular Java IDE made by JetBrains. Download IntelliJ IDEA from the official JetBrains website. The current installer includes free core Java development features. If a trial of advanced features is offered, you can skip it and continue using the free functionality.
The free features are sufficient for this beginner Java module. Install the JDK first (previous lesson).
Official downloads
On Windows
Open the Download IntelliJ IDEA page using the button above and choose Windows.
- Click Download. You get an installer (
.exe). - Double-click the
.exefile. If Windows asks for permission, click Yes. - On Installation Options, tick Create Desktop Shortcut. You can also tick Add "bin" folder to the PATH.
- Click Install, then Finish. Open IntelliJ IDEA from the Start menu or the desktop.
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.
- On the Welcome screen, click New Project.
- On the left, choose Java. Type the name
HelloApp. - Set Build system to IntelliJ.
- In the JDK dropdown, choose the JDK you installed. If the list is empty, choose Download JDK.
- 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.
- In the Project panel on the left, right-click the
srcfolder → New → Java Class. - Type
Mainand press Enter. IntelliJ makesMain.java. - Inside the class, type
psvmand press Tab. Themainmethod appears. - Inside
main, typesoutand press Tab. Then type"Hello, World!"inside the brackets.
On Windows
Now run the program.
- Click the green ▶ next to
mainand choose Run 'Main.main()'. Or press Ctrl + Shift + F10. - The output appears in the Run window at the bottom.
- To run it again later, press Shift + F10.
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 Mainmust be inMain.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 insidesrc.
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 insideC:\Program Files\Eclipse Adoptium(Temurin).
Example
public class Main { public static void main(String[] args) { System.out.println("Hello, World!"); }}Hello, World!
What this code does
psvm+ Tab typed themainline, andsout+ Tab typedSystem.out.println();.- The class is
Main, so the file isMain.java. - In the Run window you also see Process finished with exit code 0. It means the program ended without errors.
Next step
Check your understanding
6 quick questions