Single logo
  • Courses
  • Blog
  • About
Join on SkoolJoin on Skool

In this topic

Java
  • Install Java 25 (JDK) and IntelliJ IDEA, Then Run Your First Program
  • Use Claude Agent, Copilot or Junie Inside IntelliJ IDEA
  • Java Hello World with Maven: What the JDK Does and What Maven Adds
  • Java Variables, Keywords and Naming Rules
  • Maven in IntelliJ: pom.xml, Dependencies and the Build Lifecycle
  • Java Primitive Types and Memory: What int x = 5 Really Does
  • Java Strings and Text Blocks: Quotes, Concatenation and parseInt
  • Java Operators: Arithmetic, a++ vs ++a, Precedence, && || and the Ternary
  • Java Type Casting: Widening, Narrowing and Converting Text to Numbers
  • Java Practice Lab: A Cafe Bill with Variables, Operators and Casting
  • Java if, else and switch: Braces, Else-If Ladders and the Modern Switch
  • Java Loops: for, while, do-while and for-each
  • Java break, continue and Nested Loops
  • What's New in Java 21 to 25: Compact Source Files and Sequenced Collections
  • Java Arrays: Indexes, Default Values, Loops and 2D Grids
  • Java Methods and Overloading: Parameters, return and Pass-by-Value
  • Java Scope, Code Blocks and the Call Stack
  • Read User Input in Java with Scanner (and the Leftover Enter Trap)
  • Java Practice Lab: A Gym Weekly Tracker with Loops, Arrays and Methods
  • Debugging Java in IntelliJ: Stack Traces, Breakpoints and a Better AI Prompt
  • Java var: Let Java Infer the Type
  • Push and Pull in IntelliJ: Two Developers, One GitHub Repository, a Rejected Push and a Conflict
  • Java Classes and Objects: One Blueprint, Many Cars
  • Java Constructors and the this Keyword
  • Java Instance Methods, Getters, Setters and toString
  • Java static: Fields, Methods and Blocks Shared by the Whole Class
  • Java Packages and Imports: Every Class Has an Address
  • Java Access Modifiers and Encapsulation: Private Data, Public Methods
  • Java final and Immutable Objects: Assign Once, Share Safely
  • Java Strings as Objects: The String Pool, == vs equals, StringBuilder and printf
  • Java Practice Lab: A Library Book Catalogue with final Fields and StringBuilder
  • Java Inheritance: extends, super and the Order Objects Are Built
  • Java Method Overriding, @Override and the Object Class
  • Java Polymorphism: Upcasting, Dynamic Dispatch and Downcasting
  • Java Composition: Has-A vs Is-A
  • Java Abstract Classes: A Parent That Leaves One Blank
  • Java Interfaces: Contracts and Multiple Inheritance
  • Java Nested, Inner and Anonymous Classes
  • Java Enums with Fields, Methods and switch
  • Java Practice Lab: Payment Processing with an Interface, an Abstract Class and an Enum
  • Java Records: A Whole Data Class in One Line
  • Java Sealed Classes and Interfaces
  • Java Pattern Matching with instanceof and switch
  • Java Record Patterns: Unpacking a Record
  • Java equals and hashCode: Why a HashSet Needs Both
  • From Arrays to Collections: The Java Collections Framework Map
  • Java Wrapper Classes and Autoboxing
  • Java ArrayList: The Stretchy Array
  • Java LinkedList vs ArrayList: Nodes or an Array
  • Java Sets: HashSet, LinkedHashSet and TreeSet
  • Java Sorting with Comparable and Comparator
  • Java Maps: HashMap, LinkedHashMap and TreeMap
  • Java Stacks, Queues and Deques: ArrayDeque and PriorityQueue
  • Choosing a Java Collection: Immutable and Sequenced Collections
  • Java Exception Handling: try, catch and finally
  • Java throw, throws, Checked vs Unchecked and Custom Exceptions
  • Java try-with-resources and Clean Error Handling
  • Java Generics: Type-Safe Containers
  • Java Generic Methods, Bounded Types and Wildcards
  • Java Lambdas and Functional Interfaces
  • Java Built-in Functional Interfaces: Predicate, Function, Consumer, Supplier
  • Java Optional: Saying Maybe Without null
  • Java Streams I: filter, map and reduce
  • Java Streams II: Collectors, groupingBy and flatMap
  • Why Concurrency: Processes, Threads and the Main Thread in Java
  • Creating Threads in Java: Thread, Runnable and Lambdas
  • Java Thread Lifecycle: sleep, join and interrupt
  • Java Race Conditions and synchronized
  • Java volatile and Atomic Variables
  • Java ExecutorService and Thread Pools
  • Java Callable, Future and CompletableFuture
  • Java Locks, Deadlock and tryLock
  • Java Concurrent Collections and Virtual Threads
  • Why Slow Work Belongs off the Request Thread: 202 Accepted and a Job Id in Spring Boot
  • Virtual Threads in Spring Boot: One Property, and the Connection Pool Trap
  • @Async, Named TaskExecutors and Structured Concurrency in Spring Boot
  • Java Files and Directories with NIO.2: Path and Files
  • Reading and Writing Text Files in Java
  • Java Structured Data: Reading and Writing JSON and CSV
  1. Blog
  2. /
  3. Java
  4. /
  5. Basics

Java Hello World with Maven: What the JDK Does and What Maven Adds

javac compiles HelloWorld.java into bytecode and java runs it on the JVM. Maven adds one pom.xml, the same folders in every project and one build command. Then a real Maven Hello World in IntelliJ.

Chaand Sheikh

·27 November 2026·Updated 28 November 2026Basics

What you will learn

  • Explain how javac turns a .java file into bytecode and how java runs it
  • Describe what Maven adds: pom.xml, standard folders and one build command
  • Create a Maven project in IntelliJ with a valid groupId and artifactId
  • Read the output of mvn package line by line

Before you start

  • JDK 25 and IntelliJ IDEA installed

Your first Java program, done the way real projects do it: as a Maven project. Two ideas come first. The JDK compiles and runs your code. Maven organises the project and builds it with one command. Then you put both together in IntelliJ IDEA.

What the JDK gives you

Here's the whole program:

package org.studyeasy;

public class HelloWorld {
    public static void main(String[] args) {
        System.out.println("Hello, World!");
    }
}

HelloWorld.java is source code, plain text that you write. Two tools from the JDK take it from there:

  1. javac, the Java compiler, reads the file and produces HelloWorld.class. That's bytecode, made for the Java Virtual Machine (JVM), not for your processor directly.
  2. java starts the JVM, loads that class, runs its main method, and you see the output.
HelloWorld.java, plain text source, goes through javac to become HelloWorld.class, bytecode for the JVM. The java command starts the JVM, which runs main and prints Hello, World! HelloWorld.java source, plain text HelloWorld.class bytecode for the JVM JVM runs main Hello, World! javac java Both tools ship with the JDK, along with the Java libraries.
javac compiles to bytecode; java starts the JVM and runs it.

Here's the same thing in a terminal:

> javac -d out src\main\java\org\studyeasy\HelloWorld.java
> java -cp out org.studyeasy.HelloWorld
Hello, World!

-d out tells javac to put the compiled class in the out folder (as out\org\studyeasy\HelloWorld.class). -cp out tells java where to look for classes, and you run the class by its full name, package included. You won't type these every day. IntelliJ and Maven call these same two tools for you each time you click Run.

What Maven adds

For one file, the JDK is enough. Real applications use many libraries, and managing them by hand gets painful fast: you download every jar yourself, keep the versions in sync, and sort out clashes yourself. Maven takes that over.

  • One file, pom.xml. It says what you're building (a groupId, an artifactId and a version) and lists the libraries you need. Maven fetches them from Maven Central, the big public store of Java libraries, downloads each one once into a local cache (~/.m2) and reuses it.
  • The same folders everywhere. Code in src/main/java, tests in src/test/java, output in target. Open any Maven project and you know where things are.
  • One command. mvn package compiles the code, runs the tests and packs the result into a jar in target. The build works the same on your machine, your teammate's and a server.

Gradle is another build tool you'll hear about, but this course uses Maven.

Create the Maven project in IntelliJ

Step 1: a new Maven archetype project

On the welcome screen, click New Project. Under Generators, pick Maven Archetype. An archetype is a project template. (You can also make a plain Maven project from the Java page with Maven as the build system; both give you a pom.xml.) Name it Hello World, keep JDK 25 and leave the catalog on Internal, the archetype list that ships with IntelliJ.

Step 2: archetype and coordinates

From the archetype list, maven-archetype-quickstart gives you a starter class and a test. The lecture picks maven-archetype-site-simple 1.1, a bare starter with a pom.xml and a small site folder, and adds the Java code afterwards.

Open Advanced Settings. The artifactId took the name Hello World, and it's red: whitespaces are not allowed. Fix the coordinates:

FieldValueMeaning
groupIdorg.studyeasyYour organisation, usually your domain written backwards
artifactIdHelloWorldThis project's name, one word, no spaces
version1.0-SNAPSHOTSNAPSHOT means still in development

Click Create and Maven generates the project.

Step 3: the pom.xml

The project opens on pom.xml. You'll see the three coordinates (together they're the project's address) and, under properties, compiler settings: source and target 25, so Maven compiles for Java 25, and files read as UTF-8. If IntelliJ says Maven build scripts found, click Load Maven Project. The Run window shows BUILD SUCCESS. There's no Java code yet.

Step 4: add the class

You can create the class by hand. The lecture asks the AI agent in the chat panel instead, with the prompt "create a very simple hello world application out of this Maven project". (If you haven't set that up, see using an AI agent inside IntelliJ.) It creates the Maven folders src/main/java/org/studyeasy and HelloWorld.java inside them: the program you saw at the top.

Three things to notice in that code:

  • package org.studyeasy; matches the folders org/studyeasy.
  • public class HelloWorld has the same name as the file, HelloWorld.java.
  • main is where the program starts. Its one line prints the text.

Step 5: run it

Click the green Run button in the toolbar, or the green arrow next to main:

Hello, World!

Process finished with exit code 0

Exit code 0 means no error. A target folder has appeared: that's where the compiled HelloWorld.class goes. The M icon on the right edge opens the Maven tool window; under Lifecycle you'll find package.

mvn package, line by line

> mvn package
[INFO] Building HelloWorld 1.0-SNAPSHOT
[INFO] --- compiler:3.15.0:compile @ HelloWorld ---
[INFO] Compiling 1 source file with javac [debug target 25] to target\classes
[INFO] --- surefire:3.5.4:test @ HelloWorld ---
[INFO] No tests to run.
[INFO] --- jar:3.5.0:jar @ HelloWorld ---
[INFO] Building jar: target\HelloWorld-1.0-SNAPSHOT.jar
[INFO] BUILD SUCCESS
  • The compiler plugin compiles one source file with javac into target\classes.
  • The surefire plugin runs the tests. There are none yet, so "No tests to run".
  • The jar plugin packs everything into HelloWorld-1.0-SNAPSHOT.jar.

That jar runs with the plain java command:

> java -cp target\HelloWorld-1.0-SNAPSHOT.jar org.studyeasy.HelloWorld
Hello, World!

Double-clicking package under Lifecycle in IntelliJ's Maven window runs the same steps and builds the same jar.

Common mistakes

  • A space in the artifactId. IntelliJ turns the field red. Use one word: HelloWorld.
  • Class name doesn't match the file. A public class HelloWorld must live in HelloWorld.java.
  • Package doesn't match the folders. package org.studyeasy; means the file sits in org/studyeasy.
  • Running by the short name. java -cp out HelloWorld fails; use org.studyeasy.HelloWorld.

Recap

PieceJob
javacCompiles .java source into .class bytecode
javaStarts the JVM and runs main
pom.xmlCoordinates, settings and the libraries you need
Maven folderssrc/main/java, src/test/java, target
mvn packageCompile, test, then build the jar

Next: variables, keywords and naming, and later the pom.xml and the Maven lifecycle in more depth.

Keep going in Java · 3 of 79

Previous
Use Claude Agent, Copilot or Junie Inside IntelliJ IDEA
Next post
Java Variables, Keywords and Naming Rules
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE

Java 25, JSP, Hibernate, Spring Boot 4, REST APIs, React and Spring AI.View on Udemy ↗: FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE (paid course, opens in a new tab)

Related posts

Install Java 25 (JDK) and IntelliJ IDEA, Then Run Your First Program

Install JDK 25 (Microsoft Build of OpenJDK) with JAVA_HOME, install IntelliJ IDEA, then point a run configuration at the JDK and the main class and run Hello World.

Use Claude Agent, Copilot or Junie Inside IntelliJ IDEA

Open IntelliJ's AI Chat, pick Claude Agent (the agent behind Claude Code) or Copilot and a model, ask in plain words for Main.java to print the date and time, review the change, and run it.

Java Variables, Keywords and Naming Rules

A variable is a labelled jar that holds one value at a time. Four small programs show declaring, reassigning, the names Java accepts, the keywords it reserves, and why daysUntilLaunch beats d.

Maven in IntelliJ: pom.xml, Dependencies and the Build Lifecycle

Open a plain project and a Maven project in IntelliJ, read an invoice app's pom.xml, follow jackson-databind from Maven Central into ~/.m2, and see why each lifecycle phase runs the ones before it.

On this page

  • What the JDK gives you
  • What Maven adds
  • Create the Maven project in IntelliJ
  • Step 1: a new Maven archetype project
  • Step 2: archetype and coordinates
  • Step 3: the pom.xml
  • Step 4: add the class
  • Step 5: run it
  • mvn package, line by line
  • Common mistakes
  • Recap
Community · Free to join
Single logo

StudyEasy AI Community

Hosted onSkool

Learn AI engineering, share what you build, and connect with other learners.

  • Free resources: lesson files, notebooks and code

  • Ask questions and join engineering discussions

  • Meet real people learning and building with AI

Join free on Skool

Related course on Udemy

FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE

Java 25, JSP, Hibernate, Spring Boot 4, REST APIs, React and Spring AI.View on Udemy ↗: FULL STACK JAVA : JAVA + JSP + SPRING BOOT AI + REACT + VIBE (paid course, opens in a new tab)

Single logo

Empowering Education, One Course at a Time

About
About usContact us
Legal
Terms of UsePrivacy Policy

© 2026 StudyEasy Organization. All rights reserved.