Concept Explanation
You can write Java in Notepad — but you would be flying a plane with no instruments. An IDE (Integrated Development Environment) gives you autocomplete, instant error underlining, one-click run, and a debugger that pauses your program mid-flight.
For Java, three choices dominate:
| IDE | Best for | Cost |
|---|---|---|
| IntelliJ IDEA | The industry default. Smartest autocomplete. | Community edition is free |
| Eclipse | Long-standing, common in enterprise and universities. | Free |
| VS Code | Lightweight, great if you already live in it. | Free |
If you have no strong preference, install IntelliJ IDEA Community Edition. It is what most Java teams use.
Comparing Java IDEs in Practice
Choose one tool and stick with it through your first two projects so shortcuts become muscle memory:
- IntelliJ IDEA Community Edition: Best out-of-the-box ergonomics for Core Java, Maven, Gradle, JUnit, and built-in visual debugging. Free and open-source.
- VS Code + Extension Pack for Java: Ideal if you already write TypeScript or Python in VS Code and want a lighter editor with Red Hat Java language support and test runner integration.
- Eclipse IDE for Java Developers: Still common in university coursework and legacy enterprise workspaces; uses its own Workspace -> Project mental model.
Setting Up IntelliJ IDEA (Step by Step)
- Install a JDK (Java Development Kit) first (LTS 21 or 17). Note that an IDE is only an editor—it still needs a JDK to compile and execute bytecode.
- Download IntelliJ IDEA Community Edition from JetBrains and create a New Project.
- Select Java on the left, choose Maven or IntelliJ as the build system, and select your JDK in the JDK dropdown (you can also let IntelliJ download Temurin/OpenJDK right from that menu).
- Click Create to generate a standard project layout:
MyProject/
src/
main/
java/ <-- package folders & .java source files live here
.idea/ <-- local IDE configuration (exclude from Git)
pom.xml <-- Maven dependencies & Java compiler version (if using Maven)
First-Day Debugger & Editor Shortcuts
Learning four shortcuts early saves hours of print-statement debugging:
- Shift + F10 (Windows/Linux) or Ctrl + R (macOS) — run the active
mainmethod or test. - Click the left gutter next to any line number — toggle a breakpoint, then launch in Debug mode to inspect variable values line by line.
- Ctrl + Space — trigger smart autocomplete and automatic
importstatements. - Shift + F6 — safely rename a class, method, or variable across every file in your project.
- Type
soutthen press Tab — expands toSystem.out.println();psvmexpands topublic static void main(String[] args).
Common Mistakes
- No Project SDK selected: If
StringorSystemshows red underlines, open File -> Project Structure -> Project and attach your installed JDK. - Writing
.javafiles outsidesrc: Java source roots must be marked as Sources Root (blue folder icon in IntelliJ) or the compiler will ignore them. - Confusing JRE vs JDK: A JRE can run compiled programs but lacks
javac. Development requires a full JDK. - Installing Ultimate by mistake: Community Edition covers Core Java, Maven, Gradle, and JUnit without a license.
Best Practices
- Keep one workspace per module or project: Small isolated projects compile in milliseconds and prevent an error in lesson 2 from blocking lesson 5.
- Use the formatter (
Ctrl + Alt + L): Clean indentation exposes missing braces immediately. - Commit
.gitignore, never.idea/: Keep IDE window layout out of shared repositories while checking insrc/andpom.xml/build.gradle.
Practice Exercises
- The Setup & Verification: Install IntelliJ IDEA Community Edition (or VS Code Java Pack), link JDK 21, and run
System.getProperty("java.version")to verify the active runtime. - Live Template Drill: In a new
Mainclass, generatemainwithpsvmand three print lines withsout, then run and format the file with your IDE shortcut. - First Breakpoint: Set a breakpoint on a variable assignment, launch the debugger instead of plain Run, and inspect its value in the Variables panel before stepping over (
F8).