Run a Java applet

Run a java applet in modern browsers

CheerpJ can run Java applets in the browser seamlessly. This page will help you getting started with CheerpJ for Java applets.

There are two different ways to run a Java Applet in the browser:

Running your own applet

You will need:

  • Your applet file(s)
  • The HTML file where your applet is meant to be displayed.
  • A basic HTTP server to test locally

1. Integrating CheerpJ in your HTML file

This tutorial assumes you already have an HTML file with an <applet>, <object> or <embed> tag.

In order to integrate CheerpJ, you just need to add:

  1. A simple <script> within the <head> of your page with the CheerpJ runtime loader.
<script src=""></script>
  1. A second script calling cheerpjInit() to initialize CheerpJ’s runtime environment.

For example:

<!doctype html>
<html lang="en">
<meta charset="utf-8" />
<title>CheerpJ applet test</title>
<script src=""></script>

2. Host your page locally

You can now serve this web page on a simple HTTP server, such as the http-server utility.

Terminal window
npm install http-server
http-server -p 8080

In case your users have a native Java plugin installed, you can replace the original HTML tag with a cheerpj- prefixed version. <cheerpj-applet>, <cheerpj-object>, and <cheerpj-embed> are all supported.

Running a public applet

1. Install the CheerpJ applet runner

CheerpJ Applet Runner is available for Chrome and Edge.

2. Go to a website with an applet

Visit a page with a Java applet, such as this one and click on the CheerpJ Applet Runner icon in the toolbar and enable CheerpJ.

The result

You will see the CheerpJ display on your browser with some loading messages before showing your applet running. Depending on your application and the optimizations applied, this could take just a few seconds.

Further reading

Was this page helpful?
Suggest changes