The Rise and Fall of Java Applets: A Web Revolution Derailed
For many developers who started their careers in the late 90s or early 2000s, Java Applets were their first taste of a truly interactive web. For those who started later, they are a historical footnote, a technology that promised a revolution but is now gone.
The story of the Java Applet is a fascinating lesson in technology, business, security, and the relentless march of progress. Let’s explore how it rose to prominence and why it ultimately had to be retired.
The Birth: “Write Once, Run Anywhere” in the Browser
In the mid-1990s, the World Wide Web was a largely static place. Pages consisted of HTML text and images. Any “interactivity” was usually limited to clicking a link to load a new page.
The Problem: How do you create rich, dynamic, application-like experiences inside a web browser?
Sun Microsystems’ Answer: The Java Applet.
Introduced in 1995 with Java 1.0, the applet was a small Java application designed to be downloaded from a web server and executed within a browser. It ran inside a sandboxed Java Virtual Machine (JVM), which was provided by a browser plugin. This was a revolutionary concept.
Diagram: The Java Applet Architecture
The Promise & The Business Driver: The famous slogan for Java was “Write Once, Run Anywhere.” Applets extended this promise to the web. You could write a single piece of code for a complex animation, a stock ticker, or a chat client, and it would theoretically run on any operating system (Windows, Mac, Solaris) inside any browser (Netscape Navigator, Internet Explorer) that had the Java plugin. For Sun, this was the ultimate Trojan horse to make Java the dominant language of the internet.
A “hello world” applet code looked something like this:
import java.applet.Applet;
import java.awt.Graphics;
// Applets were the ancestors of modern web components.
// Note the use of AWT for graphics, the precursor to Swing.
public class HelloWorldApplet extends Applet {
public void paint(Graphics g) {
g.drawString("Hello from a Java Applet!", 25, 50);
}
}
A basic applet of a set of samples that shipped (with source code) in the JDK displayed “nervous text” on the screen when loaded:
The Fall: Death by a Thousand Cuts
Despite their initial success, applets were plagued by problems that eventually led to their demise. It wasn’t one single event, but a combination of technological, user experience, and market pressures.
+-------------------------------+
| |
| THE JAVA APPLET |
| (Promised a Revolution) |
| |
+-------------------------------+
^ ^ ^ ^
| | | |
+------------+ | | +---------------+
| | | |
+-----V------------+ +----V-----+ +------V----------+ +--V---------------+
| | | | | | | |
| SECURITY HOLES | | POOR UX | | THE RISE OF | | THE MOBILE |
| (Constant Risk) | | (Slow) | | JAVASCRIPT | | REVOLUTION |
| | | | | (No Plugin!) | | (No Applets!) |
+------------------+ +----------+ +-----------------+ +------------------+
The Plugin Problem (User Experience)
The core architectural choice—relying on a browser plugin—became the applet’s Achilles’ heel. Heavyweight: The JVM was a large dependency. Startup times were notoriously slow. Users would see a blank grey box for seconds or even minutes while the JVM loaded. Installation & Updates: Users were constantly prompted to “Install the Java Plugin” or “Update your Java version.” This was a huge barrier and a point of confusion and frustration. Inconsistency: The “Write Once, Run Anywhere” dream was often a “Write Once, Debug Everywhere” reality. Subtle differences between browser plugin implementations and JVM versions led to inconsistent behavior.
The Security Nightmare (Technological & Business)
This was the nail in the coffin. The Java plugin, sitting between the untrusted web and the user’s operating system, became one of the single largest attack vectors on personal computers. Sandbox Escapes: Malicious applets were constantly finding new ways to escape the Java sandbox and execute arbitrary code, leading to malware infections. Constant Zero-Day Exploits: For years, a significant percentage of system compromises were traced back to unpatched Java plugin vulnerabilities. Browser Response: Browsers like Chrome and Firefox began taking defensive measures, first by click-to-play (forcing users to explicitly activate the plugin) and then by blocking it entirely. From a risk management perspective, the plugin was too dangerous to leave enabled.
The Rise of a Native Competitor (Technological)
While applets struggled, a once-maligned scripting language was quietly becoming incredibly powerful: JavaScript. Good Enough, and Already There: JavaScript ran natively in every browser. There was no plugin to install. Performance: With the advent of powerful JIT-compiling JavaScript engines like Google’s V8, the performance gap narrowed significantly for many tasks. AJAX: Asynchronous JavaScript and XML (later JSON) allowed web pages to fetch data from a server in the background without a full page reload. This enabled the creation of responsive, single-page applications (SPAs) that felt like desktop apps—fulfilling the original promise of applets, but in a native, lightweight way.
The Mobile Revolution (Market)
In 2007, the iPhone was released. Apple made a deliberate choice not to support Flash or Java Applets on iOS. In his famous 2010 letter, “Thoughts on Flash”, Steve Jobs laid out a damning case against browser plugins, citing security, performance, and battery life. Everything he said about Flash applied equally to Java Applets. The future was mobile, and applets had no place in it.
The Official Timeline of the End
- ~2013-2016: Major browsers (Chrome, Firefox, Edge) begin phasing out and then completely remove support for the NPAPI plugin architecture that applets depended on.
- September 2017: With the release of Java 9, the Applet API was officially deprecated for removal. The JEP 289 announcement stated the obvious: “the Applet API is no longer relevant in a world where browser vendors have been removing support for Java browser plug-ins”.
- March 2019: The Applet API and the appletviewer tool were completely removed from the Oracle JDK with the release of Java 11 (LTS).
What Replaced Applets?
The spirit of the applet lives on in modern technologies:
- For In-Browser Rich Interactivity: This space is now completely owned by the modern web platform: HTML5 (e.g.,
- For Running Other Languages in the Browser: WebAssembly (Wasm) is the modern, secure, and performant successor. It allows code written in languages like C++, Rust, and C# to be compiled to a binary format that runs in the browser, providing near-native performance without the security risks of a plugin.
- For Rich Client Java Applications: The desire for desktop-like applications didn’t go away. It moved to technologies like Java Web Start (which itself was later removed) and today, standalone applications packaged with modern tools like jpackage, which create native installers for Windows, macOS, and Linux.
The story of the Java Applet is a valuable lesson: even a revolutionary idea can fail if its architecture creates a poor user experience and cannot adapt to a changing security and market landscape.