Using a Java IDE: IntelliJ IDEA, VS Code and Eclipse for Beginners
Why professional Java developers use an IDE, how to choose between IntelliJ IDEA, Eclipse, VS Code and NetBeans, and how to create a project, run it, fix compile errors with quick fixes, and step through code with the debugger.
kvi5hnuCode Sprout team member12 min readOn this page
In the previous article you compiled and ran Java by hand. That skill is valuable for troubleshooting, but for everyday work you should use an integrated development environment (IDE). A Java IDE combines an editor, compiler, runner, debugger, refactoring tools and documentation browser in one window, and it checks your code while you type. Modern Java IDEs are so capable that writing serious Java without one makes little sense.
This article covers:
- what an IDE does for you,
- the main free Java IDEs and how to choose,
- creating and running a project in IntelliJ IDEA, Eclipse and VS Code,
- finding and fixing compile errors with the IDE's help,
- a first look at the debugger.
What an IDE Gives You

| Feature | What it does | Why it matters |
|---|---|---|
| Project view | Shows your source folders, packages, libraries | Navigate large codebases quickly |
| Smart editor | Syntax highlighting, auto-indentation, matching braces | Readable code, fewer typos |
| Code completion | Type Math. and see every method with its parameters | You don't need to memorise the library |
| On-the-fly error checking | Red squiggles under errors as you type, before you compile | Find mistakes in seconds |
| Quick fixes | A lightbulb offers to fix the error (add an import, correct a name) | Fixes common problems in one keystroke |
| Run button | Compiles and runs with one click; output appears in a console panel | No terminal commands needed |
| Debugger | Pause a running program, inspect variables, step line by line | The most effective way to understand bugs |
| Refactoring | Safely rename a class or method everywhere, extract code into a method | Change code without breaking it |
| Navigation | Jump to a class or method definition, including library source | Learn from the JDK's own code |
| Build-tool and Git integration | Maven/Gradle projects, version control | How real projects are organised |
Choosing an IDE
All of these are free and work on Windows, macOS and Linux:
| IDE | Strengths | Notes |
|---|---|---|
| IntelliJ IDEA (JetBrains) | The most widely used Java IDE; excellent code analysis, completion and refactoring | Since version 2025.3, a single product: the core Java features are free, and advanced (framework, enterprise) features need a subscription. Students and teachers can get those free via JetBrains' education program. |
| Eclipse IDE (Eclipse Foundation) | Long-established, fully open source, huge plugin ecosystem, incremental compiler | Choose the Eclipse IDE for Java Developers package |
| Visual Studio Code + Extension Pack for Java | Lightweight, popular for many languages | Java support comes from extensions (Red Hat's language server, Microsoft's debugger and test runner) |
| Apache NetBeans | Simple, open source, good Maven support | Smaller community today |
Recommendation: If you have no preference, use IntelliJ IDEA. If you already use VS Code for other languages, its Java extensions are perfectly good for this course. Eclipse is a great choice if you prefer fully open-source tools or your team uses it. The concepts below (projects, run configurations, problems view, quick fixes, debugger) are the same everywhere; only menus and shortcuts differ.
Creating and Running a Project
IntelliJ IDEA
- Download IntelliJ IDEA from jetbrains.com/idea and install it.
- On the welcome screen choose New Project.
- Select Java on the left. Enter a name (for example
hello-java) and a location. - Build system: choose IntelliJ for now. (Maven and Gradle are the professional standard, and you'll meet them later.)
- JDK: select your installed JDK 25. If it isn't listed, choose Add JDK… and point to your JDK folder, or Download JDK….
- Tick Add sample code and click Create.
- Open
src/Main.javain the project tree. Click the green ▶ arrow in the gutter next tomainand choose Run 'Main.main()'. The output appears in the Run panel at the bottom.
Eclipse
- Download the Eclipse installer from eclipse.org/downloads and choose Eclipse IDE for Java Developers.
- Start Eclipse and pick a workspace, a folder where Eclipse keeps your projects and settings.
- Choose File → New → Java Project. Enter a project name, and under JRE choose your JDK 25. (If Eclipse asks whether to create a
module-info.javafile, choose Don't Create. Modules are covered at the end of the course.) - To use existing code, untick Use default location and Browse… to the folder that contains your
.javafiles. Eclipse then works on those files in place. - Click Finish. In the Package Explorer on the left, expand the project and double-click a
.javafile to open it. - Right-click the file or project and choose Run As → Java Application. Output appears in the Console view.
Visual Studio Code
- Install VS Code from code.visualstudio.com.
- Open the Extensions view (the squares icon on the left) and install Extension Pack for Java (published by Microsoft). It bundles Red Hat's Java language support, a debugger, a test runner, Maven support and a project manager.
- Open a folder (File → Open Folder…) containing your
.javafiles, or run Java: Create Java Project from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P). - Open a file with a
mainmethod. Run | Debug links appear abovemain; click Run. Output appears in the integrated terminal.
Finding and Fixing Compile Errors
Let's make a deliberate mistake to see how the IDE helps. In your program, change String to string:
public class Welcome {
public static void main(String[] args) {
string greeting = "Welcome!"; // typo: should be String
System.out.println(greeting);
}
}
Without compiling anything, the IDE immediately:
- Underlines
stringwith a red squiggle. - Lists the error in the Problems view (Eclipse, VS Code) or the Problems tool window (IntelliJ: View → Tool Windows → Problems), with the file and line number.
- Offers a quick fix: hover over the error, or press the quick-fix shortcut, and choose "Change to 'String'".
| Action | IntelliJ IDEA | Eclipse | VS Code |
|---|---|---|---|
| Show quick fixes | Alt+Enter (⌥↩ on macOS) | Ctrl+1 (⌘1) | Ctrl+. (⌘.) |
| Jump to next error | F2 | Ctrl+. (⌘.) | F8 |
| Code completion | Ctrl+Space | Ctrl+Space | Ctrl+Space |
| Go to definition | Ctrl+B / Ctrl+click (⌘B) | F3 / Ctrl+click | F12 / Ctrl+click |
| Rename everywhere | Shift+F6 | Alt+Shift+R (⌥⌘R) | F2 |
| Reformat code | Ctrl+Alt+L (⌥⌘L) | Ctrl+Shift+F (⇧⌘F) | Shift+Alt+F (⇧⌥F) |
Clicking an entry in the Problems list moves the cursor straight to the faulty line. The lightbulb icon (💡) that appears next to many errors does the same job as the quick-fix shortcut.
Your First Debugging Session
Compile errors are the easy kind: the compiler finds them for you. Logic errors, where the program runs but gives a wrong answer, are harder. The debugger lets you pause a running program and look inside it.
Here's a program with a logic bug. It should print the average of four marks, which is 77.75:
public class Solution {
public static void main(String[] args) {
int[] marks = {72, 85, 90, 64};
int total = 0;
for (int i = 0; i < marks.length; i++) {
total += marks[i];
}
double average = total / marks.length; // bug: integer division
System.out.println("Total: " + total);
System.out.println("Average: " + average);
}
}
Total: 311
Average: 77.0
The total is right, but the average is 77.0 instead of 77.75. Let's investigate with the debugger:
- Set a breakpoint. Click in the gutter (the margin left of the code) next to the line
double average = …. A red dot appears. A breakpoint tells the debugger "pause before executing this line". - Start in debug mode. Use the 🐞 Debug button instead of Run (IntelliJ: the bug icon or Shift+F9; Eclipse: Debug As → Java Application; VS Code: the Debug link above
mainor F5). The program runs until it reaches the breakpoint, then pauses with that line highlighted. - Inspect variables. The Variables panel shows
marks = [72, 85, 90, 64],total = 311. So far everything is correct. - Step over the line (IntelliJ F8, Eclipse/VS Code F6/F10). Now the panel shows
average = 77.0. The bug is on this line. - Evaluate expressions. Most debuggers let you type an expression while paused (IntelliJ: Evaluate Expression, Alt+F8; VS Code: the Debug Console). Evaluating
total / marks.lengthgives77, anint. Both operands areint, so Java performs integer division, discarding the fraction, before the result is converted todouble. - Fix and re-run. Convert one operand to
doublefirst:
double average = (double) total / marks.length; // 77.75
You'll learn exactly why integer division behaves like this in the operators article. What matters here is the technique: pause, look at the real values, step, and compare what is with what you expected.
| Debugger action | What it does | IntelliJ | Eclipse | VS Code |
|---|---|---|---|---|
| Resume | Run to the next breakpoint | F9 | F8 | F5 |
| Step over | Execute the current line, don't enter method calls | F8 | F6 | F10 |
| Step into | Enter the method called on the current line | F7 | F5 | F11 |
| Step out | Finish the current method and return to the caller | Shift+F8 | F7 | Shift+F11 |
| Stop | End the program | Ctrl+F2 | Ctrl+F2 | Shift+F5 |
(Shortcuts vary between platforms and keymaps; the toolbar buttons always work.)
Where Your Files Live
IDEs organise code into projects. A plain IntelliJ or Eclipse Java project typically looks like:
hello-java/
├── src/ ← your .java source files
│ └── Welcome.java
├── out/ or bin/ ← compiled .class files (created by the IDE)
└── .idea/ or .project ← IDE settings (don't edit by hand)
Projects built with Maven or Gradle, the standard in industry, use a different, conventional layout:
my-app/
├── pom.xml (Maven) or build.gradle (Gradle)
└── src/
├── main/java/ ← application code
└── test/java/ ← unit tests
Every IDE opens Maven and Gradle projects directly, which is why they are so popular: the build works the same in every IDE and on the command line.
Common questions
Which IDE do most Java developers use? IntelliJ IDEA has been the most popular in developer surveys for years, followed by VS Code and Eclipse. All three handle this course well. Recent IntelliJ IDEA releases ship as a single download whose core Java features are free; the paid subscription unlocks extra features such as framework and database tools.
The IDE says my code is fine, but it fails on the command line (or the other way round). Why?
The two are almost always using different JDKs or different language levels. Check the project's SDK and language level in the IDE, and run javac --version in the terminal. Making them match fixes the mismatch.
My IDE shows a newer feature as an error. What's wrong? The project's language level is set lower than the feature needs, for example level 17 for a Java 21 pattern switch. Raise the language level (IntelliJ: Project Structure → Project → Language level; Eclipse: Java Compiler → Compiler compliance level). Preview features also need the "preview" variant of the language level.
Should I learn the command line if I have an IDE?
Yes, at least the basics from the previous article. Build servers, containers and production systems don't have an IDE. Knowing what javac, java and the class path do lets you understand errors that the IDE only partly explains.
Is AI code completion in IDEs good for learning? It's useful for boilerplate, but it can hide the concepts you are trying to learn and sometimes suggests outdated or wrong code. While studying, try writing code yourself first, then compare. Always run and understand any suggestion before you keep it.
Summary
- An IDE combines editing, compiling, running and debugging, and checks your code as you type.
- Popular free choices: IntelliJ IDEA (core features free since the 2025.3 unified release), Eclipse, VS Code with the Extension Pack for Java, and NetBeans.
- Always check which JDK your project uses.
- Errors appear as red squiggles and in the Problems view; quick fixes (Alt+Enter / Ctrl+1 / Ctrl+.) offer corrections. Read them before accepting.
- The debugger pauses at breakpoints and lets you inspect variables and step through code line by line, which is the most effective way to find logic errors.
Practice Questions
What is the difference between a compile error and a logic error? Which does the IDE's red squiggle catch?
A compile error breaks the language rules (misspelled type, missing semicolon), so the program can't be compiled at all. The IDE marks it with a red squiggle as you type. A logic error is valid code that does the wrong thing, like the integer-division average. It compiles and runs but gives a wrong result. Only testing, careful reading or the debugger reveals it.
You set a breakpoint and click Run (not Debug). The program doesn't stop. Why?
Breakpoints only take effect when the program is started in debug mode. A normal run ignores them. Use the Debug button or command.
What is the difference between "step over" and "step into"?
Step over executes the whole current line, including any method calls on it, and stops at the next line in the same method. Step into enters the method being called on the current line and stops at its first line, so you can follow what happens inside.
Your project compiles fine on the command line with Java 25 but the IDE complains that records or switch patterns are "not supported at language level". What should you check?
The project's configured JDK / language level in the IDE. It's probably set to an old version (such as 8 or 11). Change the project SDK and language level to 25 (or at least 21).
In the average example, why did the debugger show 77.0 and not 77.75?
total and marks.length are both int, so total / marks.length performs integer division, giving 77. Only afterwards is the result converted to double (77.0) for the assignment. Casting one operand to double before dividing produces 77.75.
Previous: How to Compile and Run Java Programs from the Command Line
Next: JShell Tutorial: Java's Interactive REPL for Quick Experiments
Related reading
- JShell Tutorial: Java's Interactive REPL for Quick Experiments
- How to Compile and Run Java Programs from the Command Line
- How to Install the Java JDK on Windows, macOS and Linux
- Java Collectors.toMap: Collecting Streams into Maps
- Collecting Java Stream Results: toList, toArray, joining and Summary Statistics

More in Core Java I
Java volatile, Atomics, Deadlocks and ThreadLocal: Safe Sharing Between Threads
Share data between Java threads without bugs: memory visibility and volatile, final fields, AtomicInteger and compareAndSet, LongAdder, lazy holder initialization, safe publication, lock-ordering deadlocks, ThreadLocal, InheritableThreadLocal and ScopedValue.
Java Condition Objects and the synchronized Keyword: await, signalAll, wait and notify
Make threads wait for a condition safely with Condition.await and signalAll, then learn Java's built-in alternative: synchronized methods and blocks, intrinsic locks, wait and notifyAll, choosing lock objects, client-side locking, and the monitor concept.
Java Race Conditions and ReentrantLock: Synchronizing Shared Data
Why unsynchronized threads corrupt shared data, shown step by step with a lost-update race, and how to fix it with ReentrantLock: the lock/try/finally idiom, critical sections, reentrancy and hold counts, tryLock, fair locks, and the mistakes that cause bugs.
Java invokeAll, invokeAny and Fork-Join: Running Groups of Tasks
Coordinate many concurrent tasks in Java: invokeAll to wait for every result, invokeAny to take the first success, timeouts, ExecutorCompletionService for results in completion order, structured concurrency, and the fork-join framework with RecursiveTask, RecursiveAction and work stealing.
Discussion
Sign in to ask a question or share what you learned.