The Origins of Java: Write Once, Run Anywhere

Matt George

Fractional CTO · Founder of Injuria.ai

•7 min read•

A lot of successful technology succeeds at something other than what it was built for. Java is the clearest example in programming. It was designed for interactive television and smart consumer devices, a market that did not materialize the way anyone expected. The idea underneath the project, that a program should run unchanged on any kind of machine, turned out to be far more valuable than the gadgets it was meant for. That idea carried Java from a failed set-top box experiment to the back ends of the world's largest companies and the pockets of billions of phone owners.

The Green Project and a tree called Oak

Java came out of a team at Sun Microsystems led by James Gosling, starting in 1991.[1][8] The effort was known internally as the Green Project, and its target was the coming wave of smart consumer electronics, things like interactive TV. Those devices used many different chips, and software written for one often would not run on another. The team wanted a language whose programs could move between devices without being rewritten.

Gosling first called the language Oak, after a tree outside his office window. The name had to change after a trademark search found Oak was already taken by another technology company, and in 1994 the team renamed it Java, after the coffee that fueled the work. Java 1.0 was officially released in 1996 (though Java was publicly announced and released in alpha/beta in 1995).[1] The interactive television market never took off, and for a moment the whole project looked like it might go nowhere.

Write once, run anywhere

What saved Java was the arrival of the web at exactly the right moment, and a technical idea that fit it perfectly. Instead of compiling to the machine code of one specific processor, Java compiles to an intermediate form called bytecode.[9] That bytecode runs on the Java Virtual Machine, a program that exists for every major operating system and chip, and the JVM translates the bytecode into instructions the local machine understands.[1]

The slogan was "write once, run anywhere." You compiled your program once, and the same result ran on Windows, on a Mac, on various flavors of Unix, anywhere a JVM existed. In the mid-1990s, when software had to be built separately for each platform, this was a genuinely new promise.

It also came with a reputation Java spent a decade shaking: that it was slow. Early JVMs interpreted bytecode instruction by instruction, and it showed. The fix was just-in-time compilation. The HotSpot virtual machine watches which parts of a program run most often and compiles those hot paths to native machine code on the fly, so a long-running Java server gradually becomes nearly as fast as code compiled ahead of time.[10] JIT compilation is the single biggest reason "portable" stopped meaning "sluggish," and it is why Java became viable for serious server workloads.

The web detour: applets

Java's first brush with fame came through the browser. Java applets were small programs that ran inside a web page, and in 1995 and 1996 they looked like the future of interactive content. Netscape supported them, and for a while applets were how you added animation, games, and rich behavior to a site.

Applets faded. They were slow to start, awkward to secure, and eventually overtaken by JavaScript and plugins, then by modern web standards. There is a real irony here. JavaScript was named to ride Java's popularity and was considered the toy of the two, and it is JavaScript that ended up owning the browser Java once seemed destined to run. Java won everywhere except the place it first became famous.

Where it actually won

Java's real home turned out to be the server and the enterprise. Its combination of strong static typing, automatic memory management, a vast standard library, and the run-anywhere promise made it attractive for large, long-lived business systems.[8] Banks, insurers, airlines, and governments built core software on it. A set of official enterprise specifications, J2EE and later Jakarta EE, standardized how Java handled servers, transactions, and messaging, which is exactly the kind of boring consistency that large organizations buy. The Spring framework then gave teams a less heavyweight way to build those systems, and for two decades some combination of the two has been a default for serious back ends.[2]

The language also refused to stand still, which is underrated in its survival. Generics arrived in Java 5 in 2004, and lambdas and the streams API arrived in Java 8 in 2014, each a substantial modernization that kept Java competitive with newer languages without breaking the mountain of code already written in it.[11]

Then came a second act. When Google built Android, it chose Java as the primary language for writing apps.[3] Overnight, Java became the language of the most widely used computing platform on earth, running on billions of phones.

The JVM as the lasting legacy

One of Java's most important contributions is not the language but the platform it runs on. The JVM is a remarkable piece of engineering, with decades of work poured into making it fast and reliable, and that foundation proved useful well beyond Java.[10] Scala, Clojure, Groovy, and most notably Kotlin all target the JVM, using its performance and enormous library ecosystem while offering different language designs on top.[4] Kotlin in particular became the preferred language for Android development, which means a great deal of mobile software still runs on the platform Java created, even when the code itself is not Java.

Who owns a language, anyway

Sun was acquired by Oracle in 2010, and the ownership question turned out to matter more than anyone expected. Today the language is developed in the open as OpenJDK, and most of the Java that runs in production comes from free distributions built on it by Amazon, Azul, Eclipse Adoptium, and others, not from Oracle's own JDK.[5] Since 2017 it has shipped on a predictable six-month release cadence governed through the Java Community Process, which is a large part of why a thirty-year-old language still feels current.[6][11]

The ownership question also produced one of the most consequential lawsuits in software history. Oracle sued Google over Android's reimplementation of the Java APIs, and the case ran for a decade before reaching the U.S. Supreme Court, which ruled in 2021 that Google's use was fair use.[7] That outcome did not just settle a bill. It protected the long-standing industry practice of reimplementing an interface to achieve compatibility, a practice the entire software ecosystem quietly depends on. A fight that started over Java ended up setting the rules for everyone.

Boring, and proud of it

The through line of Java's story is that the durable idea was not the product. The set-top boxes are a footnote. "Write once, run anywhere," backed by the virtual machine that made it real, outlived the market it was invented for by thirty years and counting. Java is rarely anyone's idea of exciting, and in infrastructure that is close to the highest compliment you can pay a technology. The flashy languages get the blog posts. Java got the banks, the airlines, the phones, and the Supreme Court precedent, and it is still getting the work done while newer and more fashionable tools come and go around it.

Sources (11)
  1. Oracle: Java
  2. Spring Framework
  3. Android Developers: Kotlin and Android
  4. Kotlin programming language
  5. OpenJDK
  6. Java Community Process (JCP)
  7. Google LLC v. Oracle America, U.S. Supreme Court opinion (2021)
  8. James Gosling, The Java Language Specification (Addison-Wesley Professional, 2000)
  9. Haythem Balti, Alan Galloway, Job Ready Java (John Wiley & Sons, 2021)
  10. Peter Haggar, Practical Java (Addison-Wesley Professional, 2000)
  11. Benjamin J Evans, Jason Clark, David Flanagan, Java in a Nutshell ("O'Reilly Media, Inc.", 2023)

Recommended reading

The Origins of TypeScript: Adding a Type System to JavaScript7 min readJavaScript's flexibility is a gift on a small page and a liability in a large codebase. TypeScript was Microsoft's answer: keep the language, add a type system on top. Here is where it came from and why it won when every earlier attempt failed.The Origins of Go: Simplicity as a Feature8 min readGo was a reaction. Three veteran engineers at Google, frustrated by slow builds and growing complexity, built a language that left features out on purpose. That restraint made it the language of modern cloud infrastructure.The Origins of PHP: The Accidental Language That Runs Much of the Web6 min readPHP was never meant to be a programming language. It started as a few tools one developer wrote to track visits to his resume, survived an existential threat from Facebook, and still runs a large share of the web. Here is how.The Origins of Ruby: A Language Designed for Programmer Happiness6 min readMost languages optimize for the machine or the problem. Ruby set out to optimize for the person writing the code. That unusual goal, plus one framework, turned it into the language behind a generation of startups.The Origins of C#: Microsoft's Answer to Java5 min readC# was born out of a lawsuit. Blocked from extending Java, Microsoft built its own modern language, had it standardized so no one could call it a cage, and spent two decades turning it into a fast, open, cross-platform tool.The Origins of SQL: The Language That Refused to Die6 min readSQL is more than fifty years old, has been declared obsolete more than once, and still runs the data layer of nearly every web application. Here is where it came from, the rival language it beat, and why nothing has managed to replace it.