Java • Getting Started and Tooling

Using IDE — Use an IDE (IntelliJ/Eclipse) to run and debug a project (conceptual steps)

Learn how modern development environments help you write, run, and debug Java programs efficiently.

Java programming emblem with a coffee cup, code braces, and terminal
Inside this lesson 10 sections 5 questions 5 figures

SECTION 1

Historical Context & Motivation

Before modern tools existed, programmers wrote code in basic text editors, then had to switch to a separate terminal window to compile and run their programs. Tracking down bugs meant adding print statements everywhere and painstakingly reading through output logs. This workflow was slow, error-prone, and frustrating. The need for a single tool that could handle writing, compiling, running, and debugging code led to the creation of the Integrated Development Environment (IDE) — a software application that bundles all these tasks into one unified workspace.

1983 • Turbo Pascal Released

Borland released Turbo Pascal, one of the first widely-used IDEs. It combined a code editor and compiler in a single program, showing developers how much faster coding could be.

1995 • Java Arrives

Sun Microsystems launched the Java programming language. Its popularity created demand for Java-specific development tools that could understand Java's structure and syntax.

2001 • Eclipse IDE Launched

IBM open-sourced Eclipse, a powerful free IDE for Java. Its plugin architecture allowed the community to extend its capabilities, and it quickly became a classroom and industry standard.

2001 • IntelliJ IDEA Released

JetBrains released IntelliJ IDEA, introducing advanced features like intelligent code completion. Its Community Edition later became free and open-source, making it accessible to students.

2020s • Modern IDE Era

Today's IDEs include AI-powered suggestions, integrated version control, built-in terminal windows, and sophisticated visual debuggers — making coding more accessible than ever.

The central question this lesson addresses is straightforward: how do you use an IDE to create, run, and debug a Java project? Understanding the conceptual steps behind this process will prepare you to work confidently in IntelliJ IDEA, Eclipse, or any similar environment.

SECTION 2

Core Principles of an IDE

An IDE is more than just a text editor. It integrates several essential tools into a single application so you can focus on solving problems rather than juggling separate programs. Every major Java IDE — whether IntelliJ IDEA, Eclipse, or another — is built around the same core principles.

1

Code Editor with Syntax Highlighting

The editor color-codes your Java keywords, strings, and variables so you can read code at a glance. It also underlines errors in real time, much like a spell-checker in a word processor.
2

Project Structure & File Management

IDEs organize your source files, libraries, and resources into a project. A project panel on the side lets you browse folders and quickly navigate between classes.
3

Build & Run Integration

With a single click or keyboard shortcut, the IDE compiles your Java source code into bytecode and runs it on the JVM. You never need to type javac or java commands manually.
4

Debugger

The debugger lets you pause your running program at any line (using breakpoints), inspect variable values, and step through your code one line at a time to find and fix bugs.
5

Console / Output Panel

The console panel displays everything your program prints with System.out.println() and also shows compiler error messages, all within the IDE window.
✦

KEY TAKEAWAY

Think of an IDE like a fully equipped workshop. A carpenter could keep their saw in the garage, nails in the basement, and workbench in the backyard — but having everything in one room makes building furniture far more efficient. An IDE is your all-in-one coding workshop: editor, compiler, runner, and debugger together under one roof.

SECTION 3

Visual Explanation — The IDE Workflow

The following diagram shows the complete workflow of using an IDE to write, run, and debug a Java project. Each stage feeds into the next, and the IDE keeps you inside a single window throughout the entire process.

IDE Workflow: Write → Compile → Run → Debug1. CREATENew Project& Java Class2. WRITECode in Editor+ Autocomplete3. COMPILEIDE calls javacautomatically4. RUNOutput appearsin Console panel5. BUG FOUND?Wrong output or crash?Time to debug!6. SET BREAKPOINTSClick the gutter nextto a line number7. DEBUG MODEStep Over / Step IntoInspect variables8. FIX CODEEdit the source& re-runRepeat the cycle until the program works correctly
The IDE workflow starts with creating a project (step 1), writing code (step 2), compiling (step 3), and running (step 4). When a bug appears, you set breakpoints (step 6), enter debug mode (step 7), fix the code (step 8), and repeat until the program behaves correctly.

Notice the loop at the bottom of the diagram. Software development is inherently iterative — you write code, test it, find issues, fix them, and test again. The IDE makes every step of that loop faster because you never leave the application. The compile step often happens automatically in modern IDEs, and the debugger replaces the tedious process of scattering System.out.println() calls throughout your code.

SECTION 4

How the IDE Works Under the Hood

When you press the Run button in IntelliJ or Eclipse, the IDE performs several steps behind the scenes. Understanding these steps helps you troubleshoot problems and appreciate what the tool is doing for you.

Step A — Compilation

The IDE invokes the Java compiler (javac) on your .java source files. The compiler translates your human-readable Java code into bytecode — a set of instructions stored in .class files. If there are syntax errors (like a missing semicolon), the IDE catches them here and highlights the exact line in red.

Step B — Execution

After compilation succeeds, the IDE launches the Java Virtual Machine (JVM) and tells it to execute the bytecode starting from the public static void main(String[] args) method of your specified class. The console panel inside the IDE captures all standard output and error streams, so you see the results instantly.

Step C — Debugging

When you run in debug mode, the IDE connects to the JVM through a special debugging protocol called JDWP (Java Debug Wire Protocol). This connection lets the IDE pause execution at breakpoints, read the values of all variables in memory, and let you control execution one line at a time. Think of it as a remote control for your running program.

Under the Hood: Source → Bytecode → JVMYour Source CodeMain.javapublic class Main { // your logic}javac CompilerChecks syntax &produces .class filesBytecodeMain.classPlatform-independentinstructionsJava Virtual Machine (JVM)Executes bytecodeon your operating systemIDE Debugger (JDWP)Connects to JVM to pause,inspect & step through codeConsole Output: "Hello, World!"
Your .java source file is compiled by javac into bytecode (.class), which the JVM then executes. When debugging, the IDE connects to the JVM via JDWP (dashed pink line) to control and inspect the running program.

SECTION 5

Key IDE Actions — A Detailed Breakdown

Now let's break down the most important actions you perform inside an IDE when working on a Java project. These steps apply whether you use IntelliJ IDEA or Eclipse — the buttons may look slightly different, but the concepts are identical.

ActionWhat It DoesIntelliJ ShortcutEclipse Shortcut
Create ProjectSets up a folder structure with src/ directory, configures the JDK versionFile → New → ProjectFile → New → Java Project
Create ClassCreates a new .java file with a class skeleton already typed for youRight-click src → New → Java ClassRight-click src → New → Class
RunCompiles and executes your program, showing output in the consoleShift + F10Ctrl + F11
Set BreakpointMarks a line where execution will pause during debug modeClick the gutter (left margin)Double-click the gutter
DebugRuns the program but pauses at breakpoints so you can inspect stateShift + F9F11
Step OverExecutes the current line and moves to the next lineF8F6
Step IntoIf the current line calls a method, jumps inside that method to trace its logicF7F5
ResumeContinues execution until the next breakpoint or the program endsF9F8

Common IDE actions and their keyboard shortcuts in IntelliJ IDEA and Eclipse

💡

Pro Tip

Learning keyboard shortcuts will dramatically speed up your workflow. Start by memorizing the Run and Debug shortcuts for your chosen IDE, then gradually learn Step Over and Step Into. You'll be debugging like a pro in no time.

SECTION 6

Worked Example — Running & Debugging a Java Program

Let's walk through a realistic scenario. Suppose you have a program that is supposed to calculate the average of three quiz scores, but it's giving the wrong answer. We'll use the IDE to find and fix the bug.

Debugging a Faulty Average Calculator

  1. 1

    Step 1 — Create the Project and Class

    Open your IDE (IntelliJ or Eclipse). Go to File → New → Project, name it QuizAverage, and select the JDK version. Then right-click the src folder and create a new Java class called Main.
    Project structure created with Main.java ready for editing.
  2. 2

    Step 2 — Write the Code

    Type the following code in the editor. Notice the bug — can you spot it? int a = 85, b = 90, c = 78; int average = a + b + c / 3; System.out.println("Average: " + average); The code compiles successfully because there are no syntax errors — the bug is a logic error.
    Code compiles without errors but has a logic bug (operator precedence issue).
  3. 3

    Step 3 — Run the Program

    Press Run (Shift+F10 in IntelliJ). The console outputs Average: 201. The expected average of 85, 90, and 78 is 84 — so 201 is clearly wrong. Time to debug!
    Output: 201 (incorrect — expected ≈ 84)
  4. 4

    Step 4 — Set a Breakpoint and Start Debugging

    Click in the gutter next to the line int average = a + b + c / 3; to set a breakpoint (a red dot appears). Now press Debug (Shift+F9 in IntelliJ). The program pauses right before executing that line.
    Execution pauses at the breakpoint. Variables panel shows a = 85, b = 90, c = 78.
  5. 5

    Step 5 — Step Over and Inspect

    Press Step Over (F8 in IntelliJ) to execute the line. Now look at the Variables panel — it shows average = 201. The problem is clear: Java evaluates c / 3 first (78 / 3 = 26 in integer division), then adds a + b + 26 = 201. You need parentheses: (a + b + c) / 3.
    Bug found: missing parentheses caused incorrect order of operations.
  6. 6

    Step 6 — Fix and Re-run

    Stop the debugger, change the line to int average = (a + b + c) / 3;, and press Run again. The console now shows Average: 84. Bug fixed!
    Output: 84 ✓ — Program now works correctly.

SECTION 7

IntelliJ IDEA vs. Eclipse — Strengths & Limitations

Both IntelliJ IDEA (Community Edition) and Eclipse are free, powerful, and widely used for Java development. Choosing between them is partly a matter of personal preference, but there are meaningful differences worth understanding.

FeatureIntelliJ IDEA (Community)Eclipse
Setup ExperienceClean installer; guided project setup wizard makes getting started easyRequires choosing a "workspace" on first launch, which can confuse beginners
Code CompletionExcellent context-aware suggestions; often predicts what you want to typeGood basic completion; requires plugins for advanced suggestions
DebuggerIntuitive debug panel with inline variable display directly in the editorPowerful debugger with a separate "Debug Perspective" layout
Plugin EcosystemCurated plugin marketplace; most features built in out of the boxMassive plugin ecosystem; highly customizable but can be overwhelming
PerformanceUses more RAM; needs a reasonably modern computer (4+ GB RAM recommended)Generally lighter on resources; runs adequately on older hardware
CostCommunity Edition is free; Ultimate Edition requires a paid licenseCompletely free and open source

Feature comparison between IntelliJ IDEA Community Edition and Eclipse IDE

✦

KEY TAKEAWAY

Choosing an IDE is like choosing between two smartphones — both make calls, send texts, and run apps. One might have a slightly better camera, the other a longer battery life. The important thing is that the core skills you learn transfer directly from one IDE to another. Master the concepts — project creation, running, breakpoints, stepping — and you can switch tools anytime.

SECTION 8

Connection to Advanced Development Practices

The basic IDE skills you're learning now form the foundation for more advanced development practices that professional software engineers use every day. As you grow as a programmer, you'll encounter tools and workflows that build directly on these concepts.

What You Learn NowWhat It Leads To
Running a single-file projectBuild systems like Maven or Gradle that manage large multi-file projects with dozens of dependencies
Setting breakpoints to find bugsConditional breakpoints, watch expressions, and remote debugging of applications running on servers
Reading console outputLogging frameworks (Log4j, SLF4J) that write structured logs for production applications
Manually testing by running the programUnit testing with JUnit, where the IDE runs automated tests and reports pass/fail results
Saving files locally on your computerVersion control with Git (integrated into both IntelliJ and Eclipse), enabling collaboration with teams

How today's IDE skills connect to professional software engineering practices

The most important thing to recognize is that mastering the debug cycle now saves you hundreds of hours later. Professional developers spend roughly 50% of their time debugging and reading code, not writing it. The sooner you become comfortable with breakpoints, stepping, and variable inspection, the more productive you'll be in every future computer science course and project.

SECTION 9

Practice Problems

Question 1: CONCEPTUAL

What is the difference between a syntax error and a logic error? At which stage of the IDE workflow (compile or run) would each type of error be detected?
Show answer
A syntax error is a violation of Java's grammar rules, such as a missing semicolon or mismatched braces. The IDE detects syntax errors during the compile stage — the Java compiler (javac) refuses to generate bytecode and highlights the offending line in red. A logic error, on the other hand, is code that compiles and runs but produces incorrect results, like using the wrong formula. Logic errors are only discovered at the run stage (or later, during debugging) when you notice the output doesn't match expectations. The debugger is your primary tool for tracking down logic errors.

Question 2: BASIC

You want to pause your Java program at line 12 to see the value of a variable called total. List the three conceptual steps you would take in the IDE to accomplish this.
Show answer
First, click in the gutter (the left margin) next to line 12 to set a breakpoint — a red dot will appear indicating where execution will pause. Second, start the program in debug mode (Shift+F9 in IntelliJ or F11 in Eclipse) instead of normal run mode. Third, when execution pauses at line 12, look at the Variables panel in the debugger view to see the current value of 'total.' From there, you can step over to execute line 12 and see how 'total' changes, or resume execution to let the program continue.

Question 3: INTERMEDIATE

A student writes a for loop that should print the numbers 1 through 5, but it prints 0 through 4 instead. The code is: for (int i = 0; i < 5; i++) { System.out.println(i); }. Describe how you would use the debugger's Step Over feature to diagnose this problem and what fix you would apply.
Show answer
Set a breakpoint on the line containing the for loop. Start the program in debug mode. When execution pauses, use Step Over repeatedly to watch the variable 'i' change in the Variables panel. On the first iteration you'd see i = 0, then i = 1, then i = 2, and so on up to i = 4. This reveals the root cause: the loop starts at 0 instead of 1. To fix this, you have two options. You could change the initialization to 'int i = 1' and the condition to 'i <= 5' so that i takes values 1, 2, 3, 4, 5. Alternatively, you could keep the loop as-is and print 'i + 1' instead of 'i.' Either change produces the desired output of 1 through 5.

Question 4: APPLIED

You're building a grade calculator that reads five test scores from user input, calculates the average, and assigns a letter grade. The program compiles and runs, but it always outputs "F" regardless of the scores entered. Describe a systematic debugging strategy using IDE tools to isolate the bug. What specific debugger features would you use at each stage?
Show answer
Start by setting a breakpoint right after the code that reads the five scores from input. Run the program in debug mode and enter test values (e.g., 90, 85, 88, 92, 95). When execution pauses, check the Variables panel to verify that all five scores were stored correctly — this rules out input-reading bugs. Next, set another breakpoint on the line that calculates the average. Step Over that line and inspect the average variable. If the average is wrong, you've found one bug (perhaps a division error or missing parentheses). If the average looks correct, step into the section that assigns the letter grade. Use Step Over through each if/else-if condition and watch which branch executes. You might discover the conditions are checking the wrong variable, or the if-else chain is ordered incorrectly (e.g., checking 'grade >= 60' before 'grade >= 90'). The Resume feature lets you quickly jump between breakpoints if they're far apart in the code.

Question 5: CRITICAL THINKING

Some programmers argue that using System.out.println() statements for debugging is sufficient and that learning the IDE debugger is unnecessary. Write a thoughtful argument for why the visual debugger is superior for complex programs. Include at least two specific scenarios where println-debugging would be significantly harder than using breakpoints and variable inspection.
Show answer
While println-debugging works for simple programs, the visual debugger is far superior for complex scenarios. First, consider a nested loop that iterates thousands of times — adding println statements would flood the console with output, making it nearly impossible to find the exact iteration where things go wrong. With a breakpoint, you can pause at a specific iteration and inspect all variables instantly, even adding conditional breakpoints that only trigger when a variable reaches a certain value. Second, consider a bug that only appears when multiple objects interact — for example, an array that should be sorted but isn't. The debugger lets you expand the array in the Variables panel and see every element at once, whereas println would require you to write a loop just to print the array, then remove that debugging code later. Third, println-debugging requires you to modify your source code, recompile, and run again each time you want to check a different variable, creating a slow edit-compile-run cycle. The debugger lets you inspect any variable at any paused moment without changing a single line of code. Finally, there's a risk of accidentally leaving println statements in your final submission — the debugger leaves no trace in your source code.

SUMMARY

Lesson Summary

Summary

An Integrated Development Environment (IDE) like IntelliJ IDEA or Eclipse combines a code editor, compiler, runner, and debugger into a single application. The typical workflow follows a clear sequence: create a project, write code in the editor with syntax highlighting and autocomplete, compile and run with a single click, and review output in the console panel.

When bugs arise, the debugger is your most powerful tool. Set breakpoints by clicking the gutter to pause execution at specific lines, then use Step Over to execute one line at a time and Step Into to trace method calls. The Variables panel lets you inspect every variable's value at each pause, making it far easier to find logic errors than using println statements. These skills transfer across any IDE and form the foundation for professional software development.

Varsity Tutors • Java • Using IDE — Use an IDE (IntelliJ/Eclipse) to run and debug a project (conceptual steps)