Module 1 · Getting Started & Mental Models ⏱ 20 min

IDE Workflow + Build Tools Overview

By the end of this lesson you will be able to:
  • Describe the benefits of using an IDE over a plain text editor
  • Identify when `javac` is sufficient and when a build tool is needed
  • Explain the basic roles of Maven and Gradle in a Java project

You can write Java in Notepad. For a single file with no dependencies, javac and java from the command line are enough. But real projects have hundreds of files, external libraries, tests, and packaging steps. That is where an IDE and a build tool take over — not because they are mandatory, but because they remove the mechanical work that scales poorly.

Imagine you are building a small web API. You need a JSON parser, a database driver, and a testing library. Without a build tool, you visit three websites, download three JAR files, place them in a folder, and type a classpath string so long it wraps twice around your screen. Then you discover the JSON parser needs a second JAR you missed, and your tests fail with NoClassDefFoundError at runtime. That is dependency hell, and it is the exact moment you realise javac is not enough.

The IDE: more than a text editor

An Integrated Development Environment — IntelliJ IDEA, Eclipse, or VS Code with Java extensions — gives you features that scale with project size:

  • Instant compile errors as you type, before you ever run javac
  • Refactoring — rename a method and every call site updates automatically
  • Navigation — jump from a method call to its definition with one keystroke
  • Project management — the IDE understands your classpath, source folders, and dependencies

For learning, an IDE accelerates feedback. For production work, it is effectively required.

The real magic is semantic awareness. The IDE does not just see text; it builds an abstract syntax tree of your code. When you mistype a method name, it knows instantly because it has already resolved the type. When you invoke autocomplete, it suggests only methods that actually exist on that object. A text editor can colour keywords; an IDE understands what they mean.

Debugging without print statements

Debugging is where an IDE pays for itself. Instead of sprinkling System.out.println through your code and recompiling, you set a breakpoint on a line. When execution reaches it, the IDE pauses and shows every variable's current value. You can step forward one line at a time, watching the state change, or step into a method call to see its internal logic. Finding an off-by-one error in a loop takes minutes with a debugger and hours with print statements.

All three major Java IDEs are free to try. IntelliJ IDEA Community Edition is the most popular choice for pure Java work. Eclipse has been around the longest and integrates tightly with enterprise tools. VS Code with the Extension Pack for Java is the lightest option and works well if you already use it for other languages. Any of them will serve you well; the important thing is to start using one today rather than struggling with javac and a text editor.

flowchart LR
  S["Source code (.java)"] --> P["Parser"]
  P --> AST["Abstract Syntax Tree"]
  AST --> E["Error checker"]
  AST --> R["Refactoring engine"]
  AST --> A["Autocomplete"]
  AST --> D["Debugger"]
  style AST fill:#c2410c,color:#fff
An IDE parses source into an AST, then uses it for instant errors, autocomplete, navigation, and refactoring.

Build tools: why javac stops scaling

When your project grows beyond a handful of files, you face problems javac does not solve:

  • Dependency management — your project needs a JSON parser, a database driver, a testing framework. Downloading JARs by hand and adding them to the classpath is error-prone.
  • Multi-step builds — compile, run tests, package into a JAR, deploy. Doing this manually is tedious and repeatable.
  • Project structure conventions — where do source files go? Test files? Resources? A build tool enforces a standard layout so anyone can open the project and know where things live.

Maven and Gradle are the two dominant build tools. Both handle dependencies, compilation, testing, and packaging from a single configuration file.

Both tools cache downloaded libraries in a local repository on your machine. The first time you ask for version 2.15 of a JSON library, the tool downloads it from a central server; the second time, it reuses the cached copy. This saves bandwidth and guarantees that every teammate gets exactly the same version.

Dependency management runs deeper than it first appears. Libraries themselves depend on other libraries. When you ask for a JSON parser, it might need a logging framework and an annotation library. A build tool resolves this transitive dependency graph automatically, and warns you when two libraries ask for conflicting versions of the same third library.

A standard Maven project places source files in src/main/java, tests in src/test/java, and configuration files in src/main/resources. This convention means any Java developer can open your repository and immediately know where to look. Without a convention, every team invents its own layout, and new hires waste days learning where things hide.

flowchart LR
  POM["pom.xml declares dependency"] --> REM["Remote repository (Maven Central)"]
  REM --> LOC["Local repository (~/.m2)"]
  LOC --> CP["Project classpath"]
  style REM fill:#c2410c,color:#fff
  style LOC fill:#3776ab,color:#fff
Maven resolves declared dependencies, downloads them from a remote repository, and caches them locally.
A Maven dependency declaration inside pom.xml. One block replaces manual JAR hunting.
<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.15.0</version>
</dependency>

Maven vs Gradle at a glance

Concern Maven Gradle
Configuration XML (pom.xml) Groovy or Kotlin DSL (build.gradle)
Philosophy Convention over configuration Flexibility and performance
Learning curve Gentler for beginners Steeper, but more powerful
Performance Good Faster incremental builds

For beginners, Maven is often easier to read because its XML structure is explicit and repetitive. Gradle is preferred in Android and large multi-project builds where build speed matters. Both are industry standard; either is a safe choice for your first real project.

Maven's power comes from plugins bound to lifecycle phases. When you run mvn compile, Maven executes every plugin attached to the compile phase — typically generating sources, compiling Java, and copying resources. Run mvn test and it compiles and runs your tests. Run mvn package and it compiles, tests, and bundles everything into a JAR. You do not memorise these steps; the tool owns them.

Gradle's build scripts are real code, not markup. That means you can write if statements, loops, and custom functions inside build.gradle. This is powerful for large organisations that need non-standard build logic, but it also means a malformed script can be harder to debug than a malformed XML file. Maven's strictness is a guardrail; Gradle's flexibility is a racetrack. Beginners usually benefit from guardrails.

flowchart LR
  C["compile"] --> T["test"]
  T --> PA["package"]
  C -.->|plugin| CP["Compiler plugin"]
  T -.->|plugin| TP["Test plugin"]
  PA -.->|plugin| JP["JAR plugin"]
  style C fill:#c2410c,color:#fff
  style T fill:#c2410c,color:#fff
  style PA fill:#c2410c,color:#fff
Maven's default lifecycle runs phases in order: compile, then test, then package. Each phase triggers attached plugins.
Main.java — even a small project with two helper classes grows quickly without a build tool. Real, compiling Java.
public class Main {
    static class User {
        String name;
        User(String name) { this.name = name; }
    }

    static class Order {
        int id;
        Order(int id) { this.id = id; }
    }

    public static void main(String[] args) {
        User u = new User("Ada");
        Order o = new Order(1);
        System.out.println("User: " + u.name);
        System.out.println("Order: " + o.id);
    }
}
Main.java — the classic starting point. Real, compiling Java.
public class Main {
    public static void main(String[] args) {
        String ide = "IntelliJ";
        String build = "Maven";
        System.out.println("IDE: " + ide);
        System.out.println("Build: " + build);
        System.out.println("Ready to ship.");
    }
}
Exercise

What does this program print? Read it carefully and type the exact output (three lines).

public class Main {
    public static void main(String[] args) {
        String ide = "IntelliJ";
        String build = "Maven";
        System.out.println("IDE: " + ide);
        System.out.println("Build: " + build);
        System.out.println("Ready to ship.");
    }
}
Exercise

You are starting a new Java project that will use five external libraries and has twenty source files. Which approach is most appropriate?

Exercise

What does this program print? Read it carefully and type the exact output (two lines).

public class Main {
    public static void main(String[] args) {
        String tool = "Maven";
        int version = 3;
        System.out.println(tool + " v" + version);
        System.out.println("Build: success");
    }
}
Exercise

Which Maven lifecycle phase compiles source code, runs tests, and finally packages the project into a JAR?

Exercise

What happens if you delete your local Maven repository (~/.m2) and then run mvn compile?

Recap

  • A text editor and javac work for one file, but scale poorly.
  • An IDE gives you instant feedback, safe refactoring, and debugging through semantic understanding of your code.
  • Build tools automate dependencies, multi-step builds, and project structure conventions.
  • Maven uses XML and convention-over-configuration; Gradle uses DSL scripts and prioritises speed and flexibility.
  • Maven lifecycle phases run in order: compile, test, package. Each phase triggers attached plugins.
  • Missing dependencies often surface as runtime ClassNotFoundException when using manual classpaths; build tools resolve the full graph ahead of time.
  • Choose an IDE today and let the tool handle the mechanical work so you can focus on writing code.

Next you will write your first Java variables and discover why static typing catches mistakes before they reach production.

Checkpoint quiz

Which of the following is a task a build tool like Maven or Gradle handles that javac alone does not?

What is the main advantage of using an IDE over a plain text editor for Java development?

Go deeper — technical resources