πŸ“‹ Course
⌨️ Shortcuts
πŸ› Debugger
0%
Lesson 1Installation

JDK & IntelliJ Install

Before you write a single line of Java in IntelliJ, two things need to be on your machine: the JDK (which runs Java) and IntelliJ IDEA itself. This lesson gets both installed cleanly.

Step 1 β€” Install the JDK

The Java Development Kit (JDK) is what actually compiles and runs your Java code. IntelliJ is just the editor β€” it needs the JDK to do its job. The recommended version for learning is JDK 21 (the current long-term support release).

1

Download JDK 21

Go to adoptium.net (Eclipse Temurin). Click "Latest LTS release" β€” this gives you JDK 21. Download the installer for your OS (Windows .msi, macOS .pkg, Linux .deb/.rpm).

2

Run the installer

On Windows and macOS: double-click the installer and follow defaults. On Linux: sudo apt install temurin-21-jdk (after adding the Adoptium repo) or use your package manager.

3

Verify the install

Open a terminal and run: java -version. You should see openjdk version "21...". Also run javac -version β€” this confirms the compiler is installed.

Step 2 β€” Install IntelliJ IDEA

4

Download IntelliJ IDEA Community

Go to jetbrains.com/idea/download. Choose Community Edition β€” it's free, open-source, and has everything you need for Java development. The Ultimate edition (paid) adds web frameworks and databases, but you don't need it yet.

5

Install it

Windows: Run the .exe installer. Check "Add to PATH" and "Create Desktop Shortcut". macOS: Drag the .app to Applications. Linux: Extract the tar.gz to /opt/, then run bin/idea.sh. Or install via the JetBrains Toolbox App (recommended β€” handles updates automatically).

6

First launch

On first launch IntelliJ asks about UI theme and settings import. Choose Darcula (dark) or Light. Skip the import β€” start fresh. You'll end up at the Welcome Screen.

πŸ’‘
JetBrains Toolbox is worth it

The free JetBrains Toolbox app manages all JetBrains tools in one place. It handles updates automatically, lets you install/uninstall versions, and keeps your configuration across reinstalls. Download it from jetbrains.com/toolbox-app.

⚠️
IntelliJ can manage the JDK for you

If the JDK verification failed above, don't worry. IntelliJ can download and configure a JDK itself when you create your first project. In the new project wizard, click "Add SDK" β†’ "Download JDK" and select version 21.

Quick Check
What is the difference between the JDK and IntelliJ IDEA?
Lesson 2Installation

Your First Project

IntelliJ organises work into projects. A project is a folder with all your Java files, plus configuration telling IntelliJ how to build and run them. Creating one correctly takes two minutes.

1

Open the Welcome Screen

Launch IntelliJ. The Welcome Screen shows recent projects and a big "New Project" button. If you already have a project open, go to File β†’ New Project.

2

New Project settings

Select New Project from the left sidebar. Set: Name = HelloWorld, Location = wherever you keep code, Language = Java, Build system = IntelliJ (simplest for now), JDK = your JDK 21. Leave "Add sample code" checked for your first project.

3

Understand the project structure

IntelliJ creates this layout: HelloWorld/ contains src/ (your Java source files) and HelloWorld.iml (IntelliJ module config β€” don't edit this manually).

4

Run the sample code

IntelliJ creates a Main.java with a Hello World. Click the green β–Ά button in the gutter next to main, or press ShiftF10. The output appears in the Run panel at the bottom.

Project structure β€” HelloWorld
πŸ“ HelloWorld πŸ“ src β˜• Main.java πŸ“„ HelloWorld.iml πŸ“ .idea ← IntelliJ config, ignore

Opening your existing Task Manager project

If you already have a Java project from the beginner course, you don't need to create a new one. Just go to File β†’ Open and navigate to the folder containing your .java files. IntelliJ will import it and you'll need to set the JDK: File β†’ Project Structure β†’ Project β†’ SDK β€” select your JDK 21.

βœ…
src is the only folder you edit

Everything you write goes inside src/. The .idea/ folder and .iml files are IntelliJ's internal configuration β€” never edit them by hand. If you're using Git, add .idea/ to your .gitignore (except .idea/vcs.xml if you want to share VCS settings).

Quick Check
You open IntelliJ and your Main.java file shows red underlines everywhere even though the code looks right. What's the most likely cause?
Lesson 3Installation

The Interface

IntelliJ has a lot of panels. Knowing what each one is for β€” and how to summon the ones you need β€” means you never waste time hunting around the UI.

IntelliJ IDEA layout β€” key panels
β”Œβ”€ Menu Bar (File / Edit / View / Run / ...) ──────────────────────┐ β”œβ”€ Toolbar (run/debug buttons, VCS actions) ──────────────────────── β”‚ β”Œβ”€ Project Panel ─┐ β”Œβ”€β”€β”€β”€ Editor ──────────────────────┐ β”‚ β”‚ β”‚ πŸ“ src β”‚ β”‚ 1 public class Main { β”‚ β”‚ β”‚ β”‚ β˜• Main.java β”‚ β”‚ 2 public static void main... β”‚ β”‚ β”‚ β”‚ β˜• Task.java β”‚ β”‚ 3 System.out.println(...) β”‚ ←gutter β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ β”‚ β”œβ”€ ─────────────────────────────────────────────────────────────── ─ β”‚ Run / Debug / Terminal / Problems / Git panels (bottom) β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

The panels you'll use constantly

PanelWhat it's forHow to open
ProjectFile tree β€” navigate between classesAlt1 or click the πŸ“ icon on the left
EditorWhere you write code β€” always visibleDouble-click any file in Project panel
RunProgram output (System.out.println)Alt4 or run your program
DebugBreakpoints, variable inspectionAlt5 or run in debug mode
TerminalBuilt-in terminal β€” run git commandsAltF12
ProblemsAll errors and warnings in the projectAlt6
GitCommit, push, branch, historyAlt9
StructureMethods and fields in the current classAlt7

The gutter

The gutter is the thin strip to the left of your code β€” where line numbers live. It does a lot: green β–Ά run buttons appear next to main methods, red dots mark breakpoints, green/red change indicators from Git appear, and yellow lightbulbs signal available quick-fixes. You'll interact with it constantly.

The status bar

The very bottom of the window. Shows current line/column, encoding, branch name, background task progress, and the current inspection profile. If IntelliJ is doing something slow (indexing, building) it shows progress here.

πŸ’‘
double-tap Shift to find anything

The single most powerful shortcut in IntelliJ: press Shift twice to open "Search Everywhere". Type any file name, class name, method, setting, or action. It finds everything. If you can't remember a shortcut, just Search Everywhere for the action name.

Quick Check
Your program ran and printed output, but the Run panel closed. How do you reopen it?
Lesson 4Editing

Essential Shortcuts

Learning shortcuts is the single biggest productivity multiplier in IntelliJ. Developers who use the keyboard instead of the mouse write code measurably faster. These are the ones you'll use every single day.

Navigation shortcuts

Search everywhere (files, classes, actions)ShiftShift
Find a file by nameCtrlShiftN
Go to a class by nameCtrlN
Go to a method / field in current fileCtrlF12
Jump to declaration of a symbolCtrlB
Go back to previous locationCtrlAlt←
Find usages of a method/variableAltF7
Recent files switcherCtrlE

Editing shortcuts

Show quick-fix / intention actionsAltEnter
Auto-format the current fileCtrlAltL
Duplicate current lineCtrlD
Delete current lineCtrlY
Move line up / downShiftAlt↑/↓
Comment / uncomment lineCtrl/
Expand / collapse code blockCtrl+/-
Multi-cursor: add cursor belowCtrlShiftAlt↓

Run & refactor shortcuts

Run the programShiftF10
Debug the programShiftF9
Rename (variable, method, class)ShiftF6
Extract variableCtrlAltV
Extract methodCtrlAltM
Generate code (constructor, getters…)AltInsert
Optimise imports (remove unused)CtrlAltO
Toggle breakpointCtrlF8
⚠️
macOS uses ⌘ instead of Ctrl

On macOS, every shortcut that uses Ctrl on Windows/Linux uses ⌘ Cmd instead. So CtrlB becomes ⌘B. The exception: Alt stays as βŒ₯ Option. IntelliJ shows OS-correct shortcuts in all its menus.

Shortcut trainer β€” test yourself
Loading...
Quick Check
You want to find all places in your codebase where the addTask() method is called. Which shortcut do you use while your cursor is on the method name?
Lesson 5Editing

Code Completion

IntelliJ's code completion is one of the best in any IDE. It knows Java's entire standard library, your own classes, and it suggests completions as you type β€” often finishing entire statements for you.

Basic completion

As you type, IntelliJ shows a dropdown of completions automatically. Press Enter or Tab to accept the highlighted suggestion. Tab replaces the word under the cursor; Enter inserts without replacing.

If the dropdown closed, press CtrlSpace to bring it back.

Live templates β€” type a shortcut, get a block

Live templates expand abbreviations into full code blocks. These will save you enormous amounts of typing:

Type thisThen press TabGet this
soutTabSystem.out.println()
soutvTabSystem.out.println("variableName = " + variableName)
foriTabA complete for (int i = 0; i < ; i++) loop
iterTabA complete for-each loop
psvmTabpublic static void main(String[] args) {}
ifnTabif (var == null) {}
innTabif (var != null) {}
tryTabComplete try-catch block

Postfix completion β€” type after the expression

Postfix completions let you type a suffix after an expression and IntelliJ wraps it for you. Much faster than going back to the start of a line:

TypeResult
tasks.for + TabWraps in a for-each loop over tasks
condition.if + TabWraps in an if (condition) {} block
value.var + TabIntroduces a variable: var x = value
expr.not + TabWraps in negation: !expr
list.size.sout + TabSystem.out.println(list.size())

Generate code with Alt+Insert

Place your cursor inside a class and press AltInsert. IntelliJ shows a menu to generate: Constructor, Getter, Setter, equals/hashCode, toString, overridden methods. This writes boilerplate you'd otherwise type by hand β€” and gets it right every time.

Generate menu β€” Alt+Insert inside a class
// Cursor inside BankAccount class β†’ Alt+Insert β†’ Constructor... Getter Setter Getter and Setter equals() and hashCode() toString() Override Methods...
Quick Check
You type sout inside a method body and press Tab. What happens?
Lesson 6Editing

Refactoring Tools

Refactoring means restructuring code without changing what it does β€” cleaning it up, making it clearer, or reorganising it safely. IntelliJ's refactoring tools do it automatically across your entire project.

Rename β€” the most used refactoring

Press ShiftF6 on any variable, method, class, or field. IntelliJ renames it everywhere in the entire project simultaneously β€” including all usages, string references, and comments. It also checks for naming conflicts and warns you.

Never do a manual find-and-replace for renaming. One missed occurrence silently breaks your code. Always use Rename refactoring.

Extract Variable β€” CtrlAltV

Select any expression and press the shortcut. IntelliJ creates a new local variable holding that expression and replaces it (and any duplicates) throughout the method. Turns messy nested expressions into readable named variables.

Extract Variable β€” before and after
// Before: hard to read nested expression System.out.println("Tax: $" + (price * 0.08 * (1 - discountPct / 100.0))); // After Ctrl+Alt+V on the tax expression: double taxAmount = price * 0.08 * (1 - discountPct / 100.0); System.out.println("Tax: $" + taxAmount);

Extract Method β€” CtrlAltM

Select a block of code and press the shortcut. IntelliJ creates a new method with the right parameters and return type, moves the code into it, and replaces the original block with a method call. This is how you break up long methods into smaller, named ones.

Inline β€” the opposite of extract

On a variable or method, press CtrlAltN to inline it β€” replace every usage with the actual value/code and remove the variable or method. Useful when a variable is only used once and the name doesn't add clarity.

Change Signature

Right-click a method β†’ Refactor β†’ Change Signature (or CtrlF6). Add, remove, or rename parameters and IntelliJ updates every call site across the project.

πŸ’‘
Alt+Enter is your best friend

Whenever IntelliJ shows a yellow lightbulb or a red underline, press AltEnter. It shows every available quick-fix and intention action for the problem at your cursor β€” import a missing class, flip a condition, convert a loop to streams, add a null check, implement interface methods. IntelliJ almost always knows what you probably want.

Try it

Refactor your Task Manager

Open your Task Manager project and try each of these:

  • Rename addTask to createTask using ShiftF6 β€” verify every call site updated
  • Find a long expression in your code and extract it to a named variable with CtrlAltV
  • Select a block of 5+ lines and extract it to a method with CtrlAltM
  • Press AltInsert inside the Task class and generate a toString() method
Quick Check
You want to rename the field taskList to tasks across your entire project. What's the right approach?
Lesson 7Running & Debugging

Run Configurations

A Run Configuration tells IntelliJ exactly how to start your program: which class to run, what arguments to pass, which environment variables to set. Understanding them means you can run your program any way you need.

The simplest way to run

Click the green β–Ά in the gutter next to your main method, or press ShiftF10. IntelliJ automatically creates a run configuration the first time and reuses it after that. The current run configuration is shown in the toolbar dropdown at the top right.

Creating a custom run configuration

Go to Run β†’ Edit Configurations (or click the dropdown in the toolbar and choose "Edit Configurations"). Click + β†’ Application.

1

Name

Give it a descriptive name like "Task Manager - Run" or "Task Manager - with test file"

2

Main class

Click the folder icon and choose your main class (the one with public static void main). Or type the fully-qualified name: com.example.Main

3

Program arguments

If your main(String[] args) reads from args, put those arguments here. Example: --verbose debug

4

Environment variables

Add key=value pairs here instead of hardcoding secrets in your source. Example: DB_PASSWORD=secret123 (never put secrets in code!)

5

Working directory

The directory your program runs from β€” affects where relative file paths resolve. Usually the project root or module root.

πŸ’‘
multiple configurations for one project

You can have several run configurations for the same project. A "Normal run", a "Debug run with verbose logging", and a "Run with test data" are all useful to have. Switch between them from the toolbar dropdown. Press ShiftAltF10 to pick from a list.

Reading input from a file instead of typing it

If your program reads from System.in (keyboard) and you're tired of typing the same input every test run, redirect from a file: in Run Configurations β†’ Redirect input from β†’ browse to a test-input.txt file. Every run reads from that file automatically. Huge timesaver for interactive programs.

Quick Check
Your Task Manager reads from System.in and you want to test the same sequence of commands repeatedly without retyping them. What's the best IntelliJ approach?
Lesson 8Running & Debugging

The Debugger

The debugger is the most powerful tool for understanding what your code is actually doing. Instead of guessing, you pause the program at any line and inspect the exact value of every variable. This lesson will change how you fix bugs forever.

Breakpoints

A breakpoint pauses the program when execution reaches that line. Click in the gutter to the left of a line number β€” a red dot appears. Run the program with ShiftF9 (Debug, not Run). The program stops at your breakpoint and the Debug panel opens.

Debugger β€” program paused at a breakpoint
// Program paused here (highlighted in blue) for (Task task : tasks) { ← execution stopped here task.complete(); } // Variables panel shows: tasks = ArrayList[3] β–Ά click to expand [0] = Task{id=1, title="Buy groceries", completed=false} [1] = Task{id=2, title="Walk the dog", completed=false} [2] = Task{id=3, title="Do laundry", completed=true}

Stepping through code

Step Over β€” run next line, don't go into methodsF8
Step Into β€” follow the call into a methodF7
Step Out β€” finish current method, return to callerShiftF8
Resume β€” continue until next breakpointF9
Evaluate expression at current pointAltF8
Run to cursor (no breakpoint needed)AltF9

Watches and Evaluate

In the Debug panel, you can add Watches β€” expressions that IntelliJ evaluates and displays continuously as you step through code. Right-click any variable in the Variables panel β†’ "Add to Watches". Or press AltF8 to open Evaluate Expression and type any valid Java expression to see its value immediately β€” you can even call methods.

Conditional breakpoints

Right-click a breakpoint dot β†’ Condition. Enter a boolean expression. The program only pauses when that condition is true. Essential for breakpoints inside loops β€” instead of hitting it 1000 times, only break when i == 500 or task.getId() == 3.

βœ…
stop using System.out.println for debugging

Beginners scatter println statements everywhere to trace execution. The debugger does everything println does β€” and more. It shows every variable simultaneously, lets you step line by line, and doesn't require recompiling after each guess. Once you learn the debugger you'll never go back to printf debugging.

Try it

Debug your Task Manager

  • Set a breakpoint at the start of your addTask() method
  • Run in Debug mode and trigger an add operation
  • When the program pauses, inspect the tasks list in the Variables panel
  • Use F8 to step through the method line by line β€” watch variables update in real time
  • Set a conditional breakpoint that only triggers when title.length() > 10
Quick Check
You're debugging a loop that runs 500 times and the bug only appears around iteration 400. What's the most efficient approach?
Lesson 9Real-World

Git Integration

IntelliJ has first-class Git support built in. You can stage, commit, push, pull, branch, and resolve merge conflicts without leaving the IDE. The terminal is still there when you need it, but the GUI is often faster.

Enable VCS for your project

If your project doesn't have Git yet: Git β†’ Initialize Repository. If you're cloning from GitHub: File β†’ New β†’ Project from Version Control and paste the URL.

The Git panel

Press Alt9 to open the Git panel. It shows three tabs: Local Changes (modified/untracked files), Log (full commit history with graph), and Console (raw git output).

Committing

Press CtrlK to open the Commit dialog. All changed files are listed β€” check the ones you want to include (staging). Write a commit message. Click Commit (or Commit and Push to do both at once).

Open Commit dialogCtrlK
Push to remoteCtrlShiftK
Pull from remoteCtrlT
Create/switch branchClick branch name in bottom bar
Show diff for a fileCtrlD
Annotate (git blame)Right-click gutter β†’ Annotate

Resolving merge conflicts in IntelliJ

When a pull causes a conflict, IntelliJ highlights the conflicting files in red. Click Resolve in the notification, or open the file and click the purple "Merge" banner at the top. IntelliJ shows a three-panel diff: your version on the left, the incoming version on the right, and the merged result in the centre. Click the arrows (β†’ or ←) to accept each change.

IntelliJ merge conflict tool β€” 3 panels
← YOUR version + tasks.add(task); + saveToFile(); ⟷ INCOMING version β†’ + tasks.add(task); + System.out.println("Added"); ↓ RESULT (you build this by clicking arrows) tasks.add(task); saveToFile(); System.out.println("Added");
πŸ’‘
gutter change markers

Modified lines show a blue bar in the gutter. New lines show a green bar. Click any marker to see a popup with the diff and options to revert just that chunk. You never have to open a full diff view for small changes.

Quick Check
You want to commit only 2 of the 5 files you've changed. How do you do this in IntelliJ's Commit dialog?
Lesson 10Real-World

Settings & Plugins

IntelliJ is highly configurable. The right settings and a few key plugins make it significantly more comfortable to work in. These are the ones that experienced Java developers actually use.

Key settings to configure first

Open Settings with CtrlAltS (macOS: ⌘,).

Setting locationWhat to change
Editor β†’ General β†’ Auto ImportTurn on "Add unambiguous imports on the fly" and "Optimize imports on the fly" β€” IntelliJ adds and removes imports automatically as you type
Editor β†’ Code Style β†’ JavaSet tab size and indent to 4. Set the right margin (column guide) to 120 or 150. This shows a vertical line at that column so lines don't get too long.
Editor β†’ InspectionsThese control what IntelliJ warns about. The defaults are good β€” learn to read the warnings rather than disabling them.
KeymapIf you use VS Code or Eclipse, you can switch to their keymap. Or leave on IntelliJ's default (recommended β€” most tutorials use it).
Appearance & Behavior β†’ Appearance β†’ ThemeDarcula (dark) or IntelliJ Light. Many developers use the One Dark Vivid plugin theme.
Build, Execution β†’ CompilerTurn on "Build project automatically" if you want IntelliJ to compile as you type. Combined with "compiler.automake.allow.when.app.running" it recompiles in the background.

Plugins worth installing

Open Settings β†’ Plugins β†’ Marketplace to search and install.

PluginWhat it does
.ignoreHelps create and manage .gitignore files with templates for every project type
Rainbow BracketsColours matching bracket pairs β€” makes nested code much easier to read
String ManipulationLots of string operations (camelCase, snake_case, sort lines, escape/unescape) via right-click menu
SonarLintRuns code quality and security analysis as you type β€” teaches you to write better Java
LombokRequired if you use the Lombok library β€” generates getters/setters/constructors at compile time
GitToolBoxShows inline git blame annotations next to each line as you read code
⚠️
don't install too many plugins

Each plugin slows IntelliJ's startup and indexing slightly. Start with a few essentials. If IntelliJ feels slow, go to Help β†’ Diagnostic Tools β†’ Activity Monitor to see which plugins are consuming CPU. Disable ones you don't actively use.

Quick Check
IntelliJ is showing a red underline under every class you reference, saying "Cannot resolve symbol." What setting should you check first?
Lesson 11Real-World

Capstone: Pro Workflow

Pull everything together into the workflow professional Java developers actually use. This is what a productive day in IntelliJ looks like β€” using the keyboard, the debugger, and Git without breaking flow.

The complete feature workflow

Here's the sequence a senior developer follows when building a new feature. By the end of this course, this should feel natural to you:

1

Pull latest changes

CtrlT to pull. Check the Git Log panel to see what changed. Switch to a new branch from the branch picker in the bottom status bar.

2

Navigate to the right code

Double-tap Shift to search for the class or method you need. Press CtrlB to jump to declarations. Use CtrlE to switch between recently opened files.

3

Write code with completion

Use live templates (sout, fori, iter). Let IntelliJ auto-complete method names. Press AltEnter on any warning to see quick-fixes. Press AltInsert to generate boilerplate.

4

Format as you go

CtrlAltL to format any time. CtrlAltO to clean up imports. The code stays readable throughout β€” not just before commits.

5

Debug when something's wrong

Set a breakpoint at the suspect code. Press ShiftF9. Step through with F8/F7. Watch variables in the Debug panel. Don't guess β€” verify.

6

Refactor to clean up

Once it works: ShiftF6 to rename anything unclear. CtrlAltM to extract long methods. CtrlAltV to name complex expressions. Make it readable.

7

Commit with a good message

CtrlK. Stage only the relevant files. Write a clear message: what changed and why. Commit. Then CtrlShiftK to push.

🎯
the shortcuts to learn first

If you learn nothing else from this course, learn these seven: ShiftShift (find anything), AltEnter (quick-fix), CtrlB (go to definition), ShiftF6 (rename), CtrlAltL (format), ShiftF9 (debug), CtrlK (commit). Those seven will make you dramatically faster within a week.

Final Challenge

A full feature cycle in IntelliJ

Using only IntelliJ (no terminal except the built-in one), complete this workflow with your Task Manager:

  • Create a new branch called feature/task-statistics from the Git panel
  • Add a getStatistics() method that returns total tasks, completed count, and completion percentage β€” use AltInsert to help generate the structure
  • Set a breakpoint inside the method and run in debug mode β€” verify the values are correct by inspecting variables
  • Rename the method to getSummary() using ShiftF6
  • Format the file with CtrlAltL
  • Commit with a meaningful message using CtrlK
  • Push to GitHub using CtrlShiftK
Roadmap