How do I run Java applets? [duplicate]

Is there a way to run a Java applet on Chrome or Firefox?

No. Applets are no longer supported in Firefox or Chrome.

Firefox no longer provides NPAPI support (technology required for Java applets)

As of September, 2018, Firefox no longer offers a version which supports NPAPI, the technology required to run Java applets. The Java Plugin for web browsers relies on the cross-platform plugin architecture NPAPI, which had been supported by all major web browsers for over a decade. The 64 bit version of Firefox has never supported NPAPI, and Firefox version 52ESR is the last release to support the technology. It is below the security baseline, and no longer supported.

Source Java and Firefox Browser

Chrome no longer supports NPAPI (technology required for Java applets)

The Java Plugin for web browsers relies on the cross-platform plugin architecture NPAPI, which had been supported by all major web browsers for over a decade. Google's Chrome version 45 and above have dropped support for NPAPI, and therefore Java Plugin do not work on these browsers anymore.

Source Java and Google Chrome Browser


So how do I run Java applets?

Use the AppletViewer, from a JDK before Java SE 11.

The appletviewer command allows you to run applets outside of a web browser.

SYNOPSIS

appletviewer [ options ] urls ...

DESCRIPTION

The appletviewer command connects to the documents or resources designated by urls and displays each applet referenced by the documents in its own window. Note: if the documents referred to by urls do not reference any applets with the OBJECT, EMBED, or APPLET tag, then appletviewer does nothing. For details on the HTML tags that appletviewer supports, see AppletViewer Tags.

Note: The appletviewer is intended for development purposes only.

Source appletviewer - The Java Applet Viewer

Alternatively read the Oracle White Paper (pdf) Migrating from Java Applets to plugin free Java technologies, which recommends Java Web Start:

Java Web Start has been included in the Oracle JRE since 2001 and is launched automatically when a Java application using Java Web Start technology is downloaded for the first time. The conversion of an applet to a Java Web Start application provides the ability to launch and update the resulting application without relying on a web browser

See What is Java Web Start and how is it launched? for more information.

Note that both Java Applets and Java Web Start were removed completely in Java SE 11 (release September 2018). From that version on there is no (supported) way to run Applets or Web Start applications.


If you already have the files on your machine, you can try the appletviewer that (used to? still does?) ships with the JDK (Java Development Kit).