Java 26: Remove the Applet API (JEP 504)

After 28 years, the java.applet package is gone. JEP 504 removes the Applet API entirely from JDK 26, completing a deprecation journey that started in JDK 9.

Status: Standard — the java.applet package no longer exists in JDK 26.

A Brief History

JDK Event
JDK 1.0 (1996) java.applet introduced — Java runs in the browser!
JDK 9 (2017) JEP 289 — Applet API deprecated
JDK 17 (2021) JEP 398 — Applet API deprecated for removal
JDK 26 (2026) JEP 504 — Applet API removed

All major browsers removed support for the Java plugin between 2015 and 2019. With no runtime environment to execute them, Applets became dead code in the JDK. JEP 504 removes the last trace.

What Was Removed

The entire java.applet package is gone:

  • java.applet.Applet — the base class for all applets
  • java.applet.AppletContext — communication with the browser
  • java.applet.AppletStub — implementation detail for applet containers
  • java.applet.AudioClip — simple audio playback interface

Several related deprecations in AWT are also cleaned up:

  • java.awt.Frame.getFrames() no longer tracks Applet windows
  • javax.swing.JApplet — already removed in JDK 23

Any code still importing java.applet.* will fail to compile against JDK 26.

Migration Paths

Applets served three broad purposes, each with a modern equivalent:

Rich UI Applications → Swing or JavaFX

If your applet displayed a custom GUI, migrate to a standalone desktop application:

// Old: extend Applet
public class MyApplet extends Applet {
    public void init() {
        add(new Button("Click me"));
    }
}

// New: standalone Swing application
public class MyApp {
    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> {
            JFrame frame = new JFrame("My App");
            frame.add(new JButton("Click me"));
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            frame.setVisible(true);
        });
    }
}

Browser-Embedded Interactive Content → HTML5 / WebAssembly

For content that was meant to run inside a web page, modern web technologies are the replacement:

Old (Applet) Modern Equivalent
2D graphics / animation HTML5 Canvas, CSS animations, SVG
Games JavaScript + WebGL, or WebAssembly
Data charts Chart.js, D3.js, ECharts
Audio playback Web Audio API
File downloads Fetch API + Blob URLs
Signed trusted code Web Crypto API, Web Authentication

Server-Side Java Logic Called from the Browser → REST API

If the applet was really executing business logic, expose it as a proper backend:

// Old: business logic in an Applet running on the client
public class CalculatorApplet extends Applet {
    public void init() {
        // Complex calculation run in JVM inside the browser
    }
}

// New: REST endpoint — logic runs on the server, browser calls it
@RestController
public class CalculatorController {
    @GetMapping("/calculate")
    public Result calculate(@RequestParam double input) {
        return service.compute(input);
    }
}

Compile-Time Impact

Any code that referenced the java.applet package will break at compile time:

# JDK 26 compilation error
$ javac MyApplet.java
error: package java.applet does not exist
import java.applet.Applet;
              ^

To detect usage in your codebase before upgrading:

# Find all Java files importing java.applet
grep -r "import java\.applet" src/

# Find JAR files that reference Applet classes
jar tf mylib.jar | grep "Applet"

# Use jdeprscan to find deprecated/removed API usage (run on JDK 17–25)
jdeprscan --for-removal --release 26 myapp.jar

Why This Is Good

The removal is a net positive for the platform:

  • Smaller JDK footprint — less code to maintain, audit, and secure
  • Cleaner APIs — AWT and Swing no longer need to handle Applet edge cases
  • Security improvement — the browser plugin surface was a perennial attack vector; removing the API closes related code paths in the JDK itself
  • Signals Java’s evolution — each removal makes room for modern APIs

Am I Affected?

You are affected if:

  • Your code directly extends Applet or JApplet
  • You import anything from java.applet.*
  • You depend on a third-party library that extends Applet (check its release notes)

You are not affected if:

  • You use Swing, JavaFX, or web technologies for UI
  • Your Java code runs server-side only
  • You haven’t used java.applet in the last decade (almost everyone)

For the vast majority of Java developers, this change requires exactly zero migration effort.