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 using the CheerpJ runtime environment on your own webpage.
Not a Developer?
Check out our browser extension for running Java Applets while you browse in modern browsers.
Run Java Applets in your browser.
CheerpJ Applet Runner
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:
- A simple
<script>
within the<head>
of your page with the CheerpJ runtime loader.
<script src="https://cjrtnc.leaningtech.com/4.2/loader.js"></script>
- A second script calling
cheerpjInit()
to initialize CheerpJ’s runtime environment.
<script> cheerpjInit();</script>
For example:
<!doctype html><html lang="en"> <head> <meta charset="utf-8" /> <title>CheerpJ applet test</title> <script src="https://cjrtnc.leaningtech.com/4.2/loader.js"></script> </head> <body> <applet archive="Example.jar" code="ExamplePath.ExampleApplet" height="900" width="900" ></applet> <script> cheerpjInit(); </script> </body></html>