Why Applets Are Deprecated, and What to Use Instead
Every earlier lesson in this track has said, in passing, that applets are dead technology. This lesson explains exactly what that means, when it happened, and - more usefully - what to actually reach for on a real project today, whether you need a desktop GUI or interactive content inside a web page.
Two Separate Deaths, Not One
It's easy to lump "applets don't work anymore" into a single event, but it was really two independent failures, on two different timelines:
| What died | When | Why |
|---|---|---|
| Browser support | Roughly 2015-2016 | Browsers removed the NPAPI plugin architecture that applets (and Flash, and other plugins) depended on to run inside a page at all - a browser-side decision, unrelated to Java's own roadmap |
| The JDK's Applet API itself | Deprecated in Java 9 (JEP 289); marked "deprecated for removal" in Java 17 (JEP 398); removed in a later JDK release | Oracle's own long-run decision to retire an API with no working runtime target left to serve |
The practical result: applets stopped working in real browsers years before the JDK formally deprecated
the API that built them. Even the standalone appletviewer tool used throughout this track to
run applets outside a browser was itself removed, in JDK 11 - which is exactly why
Environment Setup insists on a JDK 8 install kept around
specifically for this.
Modern Alternative: Desktop GUI Applications
If what you actually want is a Java program with buttons, panels, and windows running on someone's desktop, the applet-specific parts (browser embedding, the lifecycle methods) are what's gone - the underlying idea of a Java GUI app is alive and well:
| Option | Status | Notes |
|---|---|---|
| Swing | Still bundled with the JDK | Mature, stable, and still widely used for existing and new desktop tools; directly builds on the same AWT event model this track already covers |
| JavaFX (OpenJFX) | Removed from the core JDK in Java 11; lives on as a separate, actively-maintained project you add as a dependency | More modern look and feel, CSS-like styling, generally considered nicer to build rich UIs with than Swing today |
Modern Alternative: Interactive Content in a Web Page
This is the harder case, and the honest answer is: there is no mainstream, drop-in replacement for "write Java, run it inside the browser page" anymore. Every modern browser runs JavaScript and WebAssembly, not Java bytecode, and nothing shipped by Oracle or the OpenJDK project changes that. If your goal is genuinely interactive content embedded in a web page, that content needs to be built with JavaScript, or a language that compiles to WebAssembly, from the ground up.
A handful of niche, specialized projects can compile some existing Java code to run via WebAssembly or JavaScript in a browser - GraalVM Native Image, TeaVM, and CheerpJ are examples worth knowing exist. These are aimed at specific migration scenarios (running an old Java codebase somewhere a browser can reach it), not general-purpose recommendations for typical new development - reach for plain JavaScript/WebAssembly first, and treat these as an option only if you have a large, specific body of existing Java code you're trying to bring to the web as-is.
A Related Dead Technology: Java Web Start
Worth knowing about for context: Java Web Start was a separate technology (not an applet) that let a user click a link on a web page to launch a full desktop Java application via download, outside the browser's own page. It's also deprecated and removed from modern JDKs, for similar reasons to applets - it depended on assumptions about how browsers and installed JDKs interact that no longer hold. If you run into it in old documentation, treat it the same way as applets: historical interest, not something to build on.