Java Guide: Complete Reference for Modern JVM Development
Java has powered enterprise software for nearly three decades. From its origins as a language for set-top boxes to its current role running millions of servers, Android devices, and big data pipelines, Java’s longevity is a testament to its design. This complete reference covers the Java language, the JVM architecture, the ecosystem of tools and frameworks, and the patterns that define modern development.
The Java Language
Java is a statically typed, class-based, object-oriented language with a C-family syntax. Its defining characteristics include automatic memory management (garbage collection), platform independence via bytecode, and a strong type system that catches errors at compile time.
Key Language Features
Records (Java 16+) are transparent data carriers that eliminate boilerplate. The compiler generates constructors, accessors, equals(), hashCode(), and toString():
public record User(long id, String name, String email) { }Sealed classes (Java 17+) restrict which subtypes are allowed, enabling exhaustive pattern matching. Pattern matching for instanceof and switch (Java 21+) eliminates manual casts and improves readability. See our Java 17-21 Features guide for details.
Text blocks (Java 13+) provide multi-line string literals with predictable indentation:
String json = """
{
"name": "ExcellentWiki",
"type": "wiki"
}
""";The Java Virtual Machine
The JVM is the platform that makes Java portable. Understanding its architecture helps developers write performant, reliable code.
Class Loading: The JVM loads .class files via the bootstrap, extension, and application class loaders. Custom class loaders enable hot deployment, modularity, and bytecode manipulation (ASM, ByteBuddy).
Memory Model: The heap is divided into young generation (Eden + Survivor spaces) and old generation. Garbage collectors move objects between spaces. The Metaspace (replacing PermGen in Java 8) stores class metadata.
Garbage Collection: G1GC is the default collector since Java 9. ZGC (Java 15+) offers sub-millisecond pause times. The choice depends on heap size, latency requirements, and throughput needs. Our Java Performance Tuning guide covers GC selection and tuning.
JIT Compilation: HotSpot identifies “hot” methods and compiles them to native code. Tiered compilation (from Java 8) starts with C1 (client) and escalates to C2 (server). The -XX:+PrintCompilation flag reveals JIT activity.
The Collections Framework
The java.util collections hierarchy is the most-used API in the JDK. Core types include:
- List:
ArrayList(O(1) get, O(n) insert/delete),LinkedList(Deque operations) - Set:
HashSet(O(1) ops),LinkedHashSet(insertion order),TreeSet(sorted, O(log n)) - Map:
HashMap(O(1) avg),LinkedHashMap(ordered/access-ordered),TreeMap(sorted),ConcurrentHashMap(thread-safe) - Queue:
PriorityQueue(heap),ArrayDeque(FIFO/LIFO)
See our Java Collections Framework guide for performance comparisons and usage patterns.
Concurrency
Java’s concurrency utilities (since Java 5) make multi-threaded programming safer and more productive. Key types include:
Executors— thread pool factories (cached, fixed, scheduled)FutureandCompletableFuture— asynchronous computationjava.util.concurrent.locks—ReentrantLock,ReadWriteLockAtomic*classes — lock-free thread-safe operationsConcurrentHashMap,CopyOnWriteArrayList— concurrent collections
Java 21 introduced virtual threads (Project Loom), lightweight threads managed by the JVM. They enable high-concurrency servers with simple synchronous code:
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
IntStream.range(0, 10_000).forEach(i ->
executor.submit(() -> processRequest(i))
);
---Our Java Multithreading guide covers these in depth.
Build Tools and Dependency Management
Maven and Gradle dominate the build ecosystem. Maven uses declarative XML (POM) with a fixed lifecycle. Gradle uses a Groovy/Kotlin DSL with incremental builds and a build cache. Our Java Build Tools guide compares their performance and use cases.
Frameworks and Libraries
Spring Boot is the dominant framework for web applications and microservices. It provides auto-configuration, embedded servers (Tomcat, Netty), and a vast ecosystem (Spring Data, Spring Security, Spring Cloud).
Jakarta EE offers standards-based enterprise APIs for dependency injection (CDI), persistence (JPA), messaging (JMS), and REST services (JAX-RS). See our Java Enterprise Guide.
Hibernate is the most popular JPA implementation, providing object-relational mapping for virtually all relational databases.
Java Ecosystem Trends
- Kotlin has become a popular alternative on the JVM, especially for Android and Spring Boot. See Kotlin vs Java.
- Project Loom (virtual threads) and Project Panama (foreign function & memory API) will define the next decade of Java innovation.
- GraalVM enables native image compilation, reducing startup time from seconds to milliseconds — ideal for serverless and containerized deployments.
- Quarkus and Micronaut offer compile-time dependency injection for fast startup in cloud environments.
FAQ
Q: Is Java still relevant for new projects in 2025? A: Yes. Java 21 LTS brings modern features, and the ecosystem (Spring, Jakarta, Quarkus) keeps it competitive with Rust, Go, and Python. It remains the best choice for enterprise backends and large-scale systems.
Q: Should I learn Java 11, 17, or 21? A: Start with Java 21 LTS. It includes all modern features, has long-term support, and is backward compatible.
Q: What IDE is best for Java development? A: IntelliJ IDEA Ultimate (paid) or Community Edition (free) is the industry standard. Eclipse and VS Code with Java extensions are also widely used.
Q: How do I get started with Spring Boot? A: Use the Spring Initializr to generate a project, then follow the official Spring Boot Getting Started guide. Baeldung’s Spring Boot tutorials are an excellent companion.
Q: What is the best way to learn Java in 2025? A: Combine the official Oracle Java Tutorials, Effective Java (Bloch), Baeldung articles, and hands-on projects. Build a REST API, a CLI tool, and a data processing pipeline.
Java Editions
Java comes in multiple editions targeting different deployment scenarios:
- Java SE (Standard Edition): The core platform — language, APIs, JVM. All Java developers start here.
- Java EE / Jakarta EE (Enterprise Edition): Adds distributed computing, web services, messaging, and persistence. Used in large-scale server applications.
- Java ME (Micro Edition): Subset for embedded and mobile devices. Less relevant since Android’s rise.
- Java Card: Ultra-minimal runtime for smart cards and SIMs.
For most developers, Java SE plus Spring Boot or Jakarta EE covers all necessary ground.
Running Java Applications
Java programs run in three modes:
- Source code (
*.java) → compiled byjavacto bytecode (*.class) → executed byjavalauncher - JAR files (Java ARchive): bundled
.classfiles + metadata →java -jar app.jar - Module path (Java 9+):
java --module-path mods -m com.excellentwiki/com.excellentwiki.Main
The java command’s -jar flag is the most common deployment mechanism. Spring Boot produces executable fat JARs containing all dependencies and an embedded server.
Package and Module System
Java modules (Project Jigsaw, Java 9+) provide strong encapsulation at the JAR level:
// module-info.java
module com.excellentwiki.core {
exports com.excellentwiki.core.model;
exports com.excellentwiki.core.service;
requires java.sql;
requires org.slf4j;
---Modules explicitly declare which packages are accessible and which modules they depend on. The JDK itself is modularized — rt.jar is replaced by java.base, java.sql, java.xml, and ~70 other modules. This improves security, startup time, and footprint.
For existing projects, starting with unnamed modules (classpath mode) is backward compatible. Add module-info.java incrementally.
Recommended Learning Path
For developers new to Java or returning after a long absence, follow this structured progression:
Phase 1 — Fundamentals (Weeks 1–4): Syntax, data types, control flow, OOP principles, packages, and basic I/O. Build a CLI calculator and a file parser.
Phase 2 — Core APIs (Weeks 5–8): Collections Framework, exception handling, generics, and the java.time API. Implement a task manager with sorting and filtering.
Phase 3 — Advanced Java (Weeks 9–12): Streams, lambdas, optional, concurrency basics, and the executor framework. Create a concurrent data processing pipeline.
Phase 4 — Tools and Frameworks (Weeks 13–16): Maven/Gradle, JUnit 5, Mockito, Spring Boot, JPA/Hibernate, and REST API development. Build a full CRUD application with database persistence.
Phase 5 — Production Skills (Weeks 17–20): Docker, CI/CD, logging (SLF4J/Logback), monitoring (Micrometer/Prometheus), cloud deployment, and performance profiling.
This path assumes 10–15 hours per week. Adjust based on prior programming experience. Each phase builds on the previous; do not skip Core APIs before tackling Streams and concurrency.
Java documentation best practices include writing Javadoc for all public APIs, using @param, @return, and @throws tags consistently, and keeping documentation in sync with code changes. The javadoc tool generates HTML documentation directly from source code comments. Modern teams also maintain ADRs (Architecture Decision Records) to document significant technical choices.
Java’s annotation processing framework (javax.annotation.processing) enables compile-time code generation. Lombok uses this to generate getters, builders, and loggers. MapStruct generates mapper implementations for bean-to-bean conversions. These tools operate at the source level, producing Java files that are compiled alongside hand-written code — reducing boilerplate without runtime overhead.
Java’s community processes (JCP and OpenJDK) ensure that language evolution is transparent and community-driven. Anyone can propose a JEP (JDK Enhancement Proposal) and participate in mailing list discussions. This open governance model has produced the most rigorously reviewed programming language specification in the industry.
Java continues to evolve rapidly — 21 LTS features (virtual threads, pattern matching, records) and upcoming projects (Valhalla for value types, Panama for foreign function access) ensure the platform remains competitive with newer languages while maintaining its enterprise stability advantage.
This reference should guide your learning and serve as a starting point for deeper dives into each sub-area. Explore the related guides in this section for focused coverage of specific topics.