Lesson 38 / 38

Packages, JARs & Build Tools

Organise code into packages, understand the classpath, and build a runnable JAR with Maven or Gradle before moving on to Advanced Java.

Packages & classpath

A package com.acme.orders; declaration maps to a folder path and namespaces your classes. The classpath tells the JVM where to find compiled classes and library JARs at runtime.

Maven / Gradle

Real projects use a build tool to fetch dependencies, compile, test, and produce a JAR. You declare dependencies once; the tool resolves the graph.

mvn package        # Maven: compile + test + build target/*.jar
./gradlew build    # Gradle equivalent
java -jar target/app-1.0.jar

Where to next

With the fundamentals solid, move on to Advanced Java: generics in depth, lambdas and streams, concurrency, JDBC, and frameworks like Spring.