Java:RunAnywhere
Drop a JVM on every machine on Earth and the same bytecode runs everywhere — that was the 1995 promise. Thirty years on, Java still sits in the TIOBE / RedMonk top three: Spring Boot is the enterprise framework, HotSpot is the most-tuned runtime in computing, and Java 21's virtual threads have clawed back high-concurrency server territory.
Sun · HotJava · WORA
Loom · pattern · sequenced
Project Loom
30 years in
What is Java
Java is a statically-typed OOP language plus virtual machine, born at Sun in 1995. The language is "write once"; the JVM is "run anywhere" — bytecode decoupled from OS and CPU. Three decades later the language has been modernised (lambdas, records, sealed types, virtual threads) while the JVM has accumulated the deepest GC / JIT engineering on the planet.
Compiles to .class bytecode, runs on any JVM. Linux / macOS / Windows / mainframe — one source. The 30-year-old promise still holds.
Everything is a class — no free functions, only static methods. The eight primitives are the only exception.
No malloc/free. Seven-plus GCs to choose from — G1, ZGC, Shenandoah, Parallel ... Low-latency servers can hit millisecond pauses with ZGC.
All types checked at compile time. Generics since Java 5, but with type erasure (List<String> at runtime is just List) — the price of 1.0 bytecode compatibility.
public class User {
private final String name;
private final int age;
public User(String n, int a) {
this.name = n; this.age = a;
}
public String getName() { return name; }
public int getAge() { return age; }
@Override public boolean equals(...) { ... }
@Override public int hashCode() { ... }
@Override public String toString() { ... }
}
// ~60 lines of boilerplate — the Java 8 stereotypepublic record User(String name, int age) { }
// One line — equals/hashCode/toString/accessors auto-generated
var a = new User("Gosling", 70);
a.name(); // "Gosling"
var grown = switch (a) {
case User(var n, var y) when y > 18 -> n;
case User u -> "minor";
};
// 30 years of modernisation, distilledHistory : Timeline
A handful of people at Sun wanted a cross-hardware language for smart TVs; thirty-five years later it's alive inside bank cores, Android servers, the entire big-data stack, and Minecraft. The arc passes through Sun's fall, Oracle's acquisition, the rise of Android, Kotlin taking mobile, and Java 21 reclaiming the server — a phoenix curve.
- 1991
Sun's "Green Project" begins
Inside Sun Microsystems, James Gosling leads the "Green Team" to build a language for smart appliances (set-top boxes, interactive TV) that runs across heterogeneous hardware. The codename is
Oak— after the tree outside Gosling's window. The smart-TV product is stillborn; the language survives. - 1994·08
First public demo at SunWorld
The pivot from set-top boxes to the Web. The name "Oak" was already trademarked, so the team brainstormed in a coffee shop and landed on Java — Indonesia's coffee island. "Coffee + cross-hardware + the network" starts to gel as a story.
- 1995·05·23
Java officially launched + HotJava browser
May 23rd, Sun unveils Java. Alongside it ships the HotJava browser, where in-page applets run client-side. "Write Once, Run Anywhere" becomes the slogan. Netscape bundles applet support that same year.
- 1996·01
JDK 1.0
The first public JDK ships with AWT, IO, networking and the applet runtime. The pitch is "one bytecode running everywhere" — a fresh promise at a time when PCs were splintered across Win 3.1 / Win 95 / Mac / various Unixes.
- 1998·12
J2SE 1.2 — Swing + Collections
Java's first "big" release. Swing replaces the crude AWT GUI toolkit; the Collections framework (
List/Map/Setwith algorithms) lands — a design later borrowed by nearly every statically-typed language. The "Java 2" brand is born. - 2004·09
J2SE 5.0 — the modern Java baseline
One release dropped generics, autoboxing, enums, annotations, varargs and the enhanced
for. Java leapt from "verbose 90s language" to "engineering mainstream" overnight. Spring, Hibernate and JUnit are all built on top of this baseline. - 2006·11
Open-sourced as OpenJDK
November. Sun releases the compiler, HotSpot VM and class libraries under GPL — the OpenJDK project is born. Java goes from "Sun's private asset" to an open one; the community can audit commits, file patches, and Linux distros can ship OpenJDK by default.
- 2008·09
Android 1.0 — Java reaches mobile
Google ships Android 1.0. The syntax is Java, but it runs on Dalvik VM rather than the JVM directly. This is the moment Java steps onto mobile — and stays the de-facto language of Android for ~10 years, until Kotlin's rise in 2017 (see /code/kotlin).
- 2010·01
Oracle acquires Sun
$7.4 billion. The Java team, HotSpot and Solaris all change hands. Oracle promptly sues Google over Java API use in Android — a decade-long lawsuit the U.S. Supreme Court ultimately resolves in Google's favor (fair use) in 2021. Java governance turns from "Sun academic" to "Oracle legal."
- 2014·03
Java 8 — lambdas, Streams, Optional
March 18th. Functional-style lands in the language:
(x) -> x*2lambdas,Streampipelines,Optional, default methods on interfaces, the newjava.timeAPI. This is the single biggest language-level modernisation in Java's history — comparable in scale to JS's ES6. Java 8 becomes the de-facto standard for years; plenty of enterprise code still sits on it today. - 2017·09
Java 9 — modules + 6-month cadence
Project Jigsaw ships: module-info.java goes live, the JDK itself is sliced into ~70 modules. Simultaneously the cadence flips to a new release every six months — controversial then ("too many minor versions"), vindicated since: language evolution moves much faster than under Sun.
- 2018·09
Java 11 LTS —
vararrivesThe first LTS (Long-Term Support) release that enterprises migrate to en masse. Brings local-variable type inference
var(not JS's var), an HTTP/2 client, and ZGC in preview. The split "Oracle JDK paid, OpenJDK free" begins here. - 2017·05
Google I/O — Kotlin first-class on Android
An Android-world earthquake: Google promotes Kotlin to first-class status. Java's mobile share starts shrinking. That thread continues over at /code/kotlin. On the server / enterprise side, meanwhile, Java actually consolidates — a tale of two halves.
- 2021·09
Java 17 LTS — modern Java starts feeling ergonomic
The second widely-adopted LTS. Brings records (one-line value classes), sealed classes, pattern matching for
instanceof, and text blocks""". For the first time Java doesn't feel cramped; many wins that Kotlin / Scala had since 2014 land back in mainline Java. - 2023·09
Java 21 LTS — virtual threads (Project Loom)
The biggest single upgrade in a decade. Virtual threads (Project Loom): the JVM ships M:N coroutine-style threads — write synchronous code, run it asynchronously — no async/await, no function colouring. Plus pattern matching for
switchand sequenced collections. Java wins back high-concurrency server territory previously ceded to Go. - 2024·09
Java 23 — patterns, GC, FFM keep advancing
Primitive type patterns stable (
switch (x) { case int i -> ... }); ZGC's generational mode becomes default and slashes large-heap latency; the FFI (Project Panama's Foreign Function & Memory API) ships stable, retiring 30 years of JNI. Two releases a year continues; engineering feels increasingly like Rust / Go's incremental march. - 2026
30 years old, still top 3
Java sits firmly in the top three on TIOBE / RedMonk year after year. Spring Boot is the de-facto enterprise Java framework. The JVM is the most-tuned runtime on the planet — dozens of GC choices, decades of JIT wisdom. AI code generation is fluent in Java because public training corpora are saturated with it (Java has been #2 or #3 on GitHub for years).
Language Essentials : JavaAlphabet
Most people's mental model of Java is frozen at version 8. The eight cards below are Java 21+ as it actually feels in 2026: class & interface, generics, Streams, Optional, records, sealed + pattern, virtual threads, the JVM itself.
Class & interface
Java is pure class+interface OOP — no free functions. Since Java 8, interfaces can carry default methods — half of Scala's trait pulled in.
interface Greeter {
String hello(String name);
default String shout(String n) {
return hello(n).toUpperCase();
}
}Generics <T>
Generics since Java 5, but with type erasure: checked at compile time, erased to Object at runtime. The cost: no new T(), no instanceof List<String> — the gain: full JVM bytecode compatibility.
class Box<T> {
private T v;
public T get() { return v; }
}
Box<String> b = new Box<>();
// runtime: just Box, T is erasedLambdas + Streams
Since Java 8, x -> x*2 is a valid lambda; Stream adds lazy pipelines over collections (filter / map / reduce / collect). Not for blocking IO, but pure computation pipelines feel nice.
var total = orders.stream()
.filter(o -> o.isPaid())
.mapToInt(Order::amount)
.sum();Optional<T>
Java's 2014 "don't return null" escape hatch. Wrap missing values in Optional at the API boundary — but unlike Kotlin, ordinary fields can still be null. Convention, not type system.
Optional<User> find(long id) { ... }
find(42)
.map(User::name)
.orElse("-");record (Java 14)
One line for a value object: final fields, equals / hashCode / toString and accessors all generated. The Java equivalent of Kotlin's data class — seven years late, but here.
record Point(int x, int y) { }
var p = new Point(3, 4);
p.x(); // 3
p.toString(); // Point[x=3, y=4]sealed + pattern matching
Since Java 17, sealed confines all legal subtypes to one file; combined with switch patterns, the compiler enforces exhaustiveness — ADT in OOP clothing.
sealed interface Shape
permits Circle, Square { }
var area = switch (s) {
case Circle c -> c.r() * c.r() * 3.14;
case Square q -> q.side() * q.side();
};Virtual threads (Java 21)
The Project Loom payoff: millions of threads with sync semantics, JVM-scheduled. Thread.startVirtualThread spawns a virtual thread; blocking IO auto-unmounts, OS threads stay free. Java no longer needs reactor frameworks for high-concurrency servers.
try (var e = Executors.newVirtualThreadPerTaskExecutor()) {
IntStream.range(0, 1_000_000).forEach(i ->
e.submit(() -> httpGet("/u/" + i)))
} // 1M virtual threads, OKThe JVM (HotSpot, GC, JIT)
Java's real moat is the runtime. HotSpot's JIT, given enough time, approaches C++ throughput; seven-plus GCs to choose from (G1 / ZGC / Shenandoah / Parallel ...); flame graphs, JFR, async-profiler all out of the box. The most-tuned runtime on the planet.
$ java -XX:+UseZGC -Xmx32g App
$ jcmd <pid> JFR.start duration=60s
$ jcmd <pid> GC.heap_infoChecked exceptions — Java's quirk
Java forces you to declare every checked exception in the method signature (throws IOException); callers must catch or rethrow. No other major language carries this rule — some people love it, some loathe it. The friction with lambdas and Streams is Java 8's most famous papercut.
"Thirty years in, every Java developer has wrestled checked exceptions at least once."
Why Java : WhyJava
Java is neither the trendiest nor the terse-est language going. But when the goal is a large codebase maintained for decades, mission-critical systems running 24/7, teams of 100+, Java's engineering payoff is still top-tier.
The JVM is the platform
The most-tuned runtime in the world. Seven-plus GCs to pick, a 25-year-old JIT, an observability stack (JFR, async-profiler, flame graphs) mature enough that a single trace fingers a GC blip. The language is Java; the moat is the JVM.
// pick a GC at launch
java -XX:+UseZGC App30 years of backward compatibility
A .class compiled in 1996 still runs on the latest JVM (modulo a handful of deprecated APIs). This is Java's unmatched stability promise — the reason enterprises trust 20-year-old codebases to keep paying rent in Java.
// jdk1.0 .class → java 23 — runsEnterprise gravity
Banks, governments, telecoms, energy grids, large data systems — most mission-critical workloads still run on the JVM. Goldman Sachs' SecDB, virtually every Wall Street matching engine, Hadoop / Kafka / Spark / Cassandra — all Java.
// Kafka, Spark, Hadoop, Flink
// → all JVM workloadsModernisation since 2017
Once Java 9 flipped to a six-month release cadence, versions 14 / 17 / 21 / 23 marched out records, sealed types, pattern matching and virtual threads. The "Java 8 forever" stereotype is years out of date — 21 LTS is the current baseline.
// Java 21+: var, records,
// sealed, switch patterns, vthreadsThe tool chain is unmatched
IntelliJ IDEA (JetBrains) is widely considered the best language refactoring experience on Earth. Maven / Gradle are the de-facto build tools. Spring Boot is enterprise Java's "Rails"; JUnit / Mockito / Testcontainers blanket the testing layer.
// IntelliJ + Maven + Spring Boot
// → 90% of Java shops, 2026Who's Using : ProductionUsers
From Wall Street matching engines to Minecraft, from Netflix microservices to NASA mission systems — when the brief is mission-critical, large-scale, long-lived, Java has few peers. The 12 below are a casual sampling.
Modernisation + : The AI Era
The "Java 8 is verbose and dull" stereotype is years out of date. Since the 2017 cadence flip, Java has shipped records, sealed types, virtual threads and FFM — clearing the modernisation backlog. Java today = 21 LTS, not 8. AI code generation is extremely fluent in Java because public training corpora are saturated with it.
"Every Java design trade-off has leaned toward stability over fashion. We waited seven years to add lambdas, twenty for records. The reward: a
.classcompiled in 1996 still runs today. Thirty years of backward compatibility isn't marketing — it's the largest enterprise-codebase preservation effort on Earth, something no "pretty but breaking" language can buy.
Shipped 2023-09. Brings virtual threads, switch patterns, sequenced collections and generational ZGC. The enterprise migration target — Spring Boot 3, Quarkus, Micronaut all sit on 21.
Project Loom: a single JVM handles ~10M virtual threads, with synchronous code auto-scheduled M:N. Java no longer needs reactor frameworks for high-concurrency servers — territory previously ceded to Go is being reclaimed.
Java has held a top-three slot on TIOBE / RedMonk for 20+ years running. Its long-time top-three position in public GitHub repos saturates LLM training data — models write Java with very few mistakes.
Virtual Threads
Project Loom decouples threads from OS resources: where machines used to top out at ~10k threads, they now scale to millions. Semantics don't change — still synchronous code with natural blocking IO — but under the hood the JVM unmounts a virtual thread on every blocking call, returning the OS thread to the pool.
- M:N scheduler — JVM maps virtual threads onto a small pool of platform threads
- Sync semantics — No function colouring — no async/await
- Auto unmount — Blocking IO / locks release the carrier OS thread
- Compatible — Same Thread API; existing code unchanged
Compared with Go's goroutines, Loom adds structured concurrency — children die with their parent scope, no leaks. Helidon Níma, Quarkus and Spring Boot are all virtual-thread-first.
// 10k IO tasks, one virtual thread each
try (var e = Executors
.newVirtualThreadPerTaskExecutor()) {
List<Future<String>> fs =
IntStream.range(0, 10_000)
.mapToObj(i -> e.submit(() ->
httpGet("https://api/u/" + i)))
.toList();
for (var f : fs) println(f.get());
}
// Reads sync, runs async, no async keywordProduction adopters
Java in the AI era — the training-data sweet spot
How accurately a large language model writes a language is roughly linear in that language's share of the training corpus. Java has held a top-three slot in public GitHub repos for years, with enormous (and stylistically uniform) volumes of internal enterprise code on top — so LLM Java output is unusually accurate, and the "refactor + let the AI fill in" workflow runs especially smoothly on Java.
The 2026 tool chain: Spring AI (Spring's first-party LLM bridge), LangChain4j (a Java port of LangChain), and the Quarkus + Micronaut cloud-native Java stack — together they make "Java for back-end AI services" stick.
Counter-intuitive truth: "prototype in Python, ship in Java" is a common pattern in AI back-ends — prototype in Python / Jupyter, but the production service is Java, because GC / JIT / tooling / team scale all hold up better.
// Spring AI · calling an LLM from Java
@Service
class ChatService {
private final ChatClient ai;
public String summarise(String doc) {
return ai.prompt()
.user(u -> u.text("summarise: " + doc))
.call()
.content();
}
}
// LangChain4j syntax is nearly identicalIn one line: Java is not the "old language stuck at 8" of common imagination. Java 21 in 2026 = records + sealed + virtual threads + pattern matching + FFM, plus thirty years of JVM moat and a training-data sweet spot for AI — still a top-tier choice for serious systems.
vs Kotlin / Go : Java vs Kotlin vs Go
On the JVM, Java's foil is Kotlin. On the concurrency front, it's Go. Kotlin is Java's spiritual heir — same JVM, less ceremony; Go takes the other route to high-concurrency servers — goroutines vs virtual threads. The table puts all three side by side.
| Java | Kotlin | Go | |
|---|---|---|---|
| Origin | Sun · 1995 | JetBrains · 2010 | Google · 2009 |
| Primary platform | JVM · server / big data / legacy Android | JVM / Android · KMP cross-platform | Native binary · server / CLI |
| Syntax weight | Lots of legacy boilerplate; much trimmed in 21+ | Concise; Java boilerplate removed | Deliberately minimal · almost no sugar |
| Null safety | Optional at API; fields can still be null | T? / T | None — zero values + error |
| Value type | record · 2020 起 | data class · 2016 起 | struct |
| Concurrency | Virtual threads · 21+ · M:N | suspend / Flow · structured | goroutines + channels · M:N |
| Pattern matching | Switch patterns · 17+ | when · sealed 穷尽 | switch · simple form |
| Generics | Type erasure (compat trade-off) | Same erasure on JVM · reified to escape | Added in 1.18 · any / generics |
| Startup | Slow JVM · GraalVM Native fixes it | Same JVM; same native-image story | Instant · static binary |
| GC | 7+ choices (G1/ZGC/...) | JVM (shared) | Single GC · low-latency tuned |
| Interop | JNI / Panama FFM (new) | 100% Java interop | cgo · with overhead |
| Ecosystem depth | 30 years deep · Spring/Hadoop/Kafka | Inherits JVM + has KMP on top | Cloud-native home · k8s/docker |
Outlook : TheRoadAhead
Loom is stable, Valhalla and Panama are moving, GraalVM Native Image puts Java on the serverless / container battlefield. The next five-year project: repackage thirty years of engineering as a 2030-shaped language.
Project Loom matures — virtual threads + structured concurrency
Java 21's virtual threads (Project Loom) are stable; structured concurrency (Loom's sibling) is in second preview as of Java 23. Translation: write blocking synchronous code; the JVM does the M:N scheduling for you. No async/await, no function colouring — Go's goroutine model, with hierarchical "parent scope ends, all children cancel" semantics on top.
The effect is that Java has clawed back a chunk of the high-concurrency server territory previously dominated by Go. Helidon Níma, Quarkus and modern Spring all wire virtual threads in.
Project Valhalla — value classes
Adds user-defined "primitive-like" types to Java: value record, flat memory layout, no identity. A Point(double x, double y) array can finally pack contiguously like C's — closing Java's last gap in heavy numerics / games / scientific computing. Currently in preview; expected 2026/2027.
Project Panama — FFM
Since Java 22, the Foreign Function & Memory API is stable, retiring 30 years of JNI. Call C / Rust libraries directly, no shim layer; zero-copy off-heap memory access. Combined with jextract auto-generating bindings, Java↔C FFI finally stops hurting.
GraalVM Native Image — AOT
Oracle's GraalVM AOT-compiles Java apps to a static native binary: millisecond startup, ~1/3 the memory, no JIT warmup — ideal for serverless / CLI / containers. The trade-off is that reflection and dynamic class loading must be registered ahead of time. Quarkus, Micronaut and Spring Boot Native already ship it to production.