12

This question already has an answer here:

Is there a way to run a Java applet on Chrome or Firefox? I get the error message on the Java test page that Java won't run on Chrome or Firefox anymore because of the non-supported NPAPI.

I have an old set of *.class files with an .html to run it, and I just want to be able to run this applet somehow. But how?

marked as duplicate by sleske, Dave M, music2myear, LotPings, bertieb Jan 19 at 22:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

20

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.

  • 3
    So how do I run Java applets? :-) – jerrrrro Jan 16 at 16:35
  • 3
    @jerrrrro Run the applets with an outdated browser in a virtual machine. – dsstorefile1 Jan 16 at 16:44
  • 3
    Note even webstart is dropped in java 11 and the 'official' way is now to use j9+ modules to create 'lean' downloadable apps although j8 remains supported for 'deployment' = webstart for a few more years – dave_thompson_085 Jan 17 at 0:26
  • 8
    @jerrrrro: apparently you missed the last decade and a half, when Java sandbox (= applet/webstart) bugs were one of the biggest and most frequent vectors for system infections and breaches. Every few weeks all the security websites announced "huge danger from browser java! remove java from all your systems NOW!", a few weeks later "okay, Sun/Oracle patched that one", a few weeks later "ANOTHER huge danger from java!". The browser makers got tired of this and removed support permanently, so Oracle made the best of it: "we didn't really want to run in browsers anymore" – dave_thompson_085 Jan 17 at 0:32
  • 4
    @jerrrrro, also, Java applets (and Flash applets) were obsoleted by HTML5 and various WebApis, which allows actual integration into the page as a whole rather than just an embedded box with basically no legal interaction with the rest of the content. – Jan Hudec Jan 17 at 7:06
4

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).

Not the answer you're looking for? Browse other questions tagged or ask your own question.