Skip to content

About

Real Java in the browser, built from OpenJDK. Issues and examples for CheerpJ: Java 8, 11, 17 and 21 apps, applets, JNLP and libraries, client-side.

Topics

Resources

Stars

688 stars

Watchers

24 watching

Forks

Latest commit

 

History

107 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

CheerpJ CheerpJ

Real Java in the browser.

A Java runtime built from OpenJDK and compiled to WebAssembly.
Build with Java, or run the applications you already have, from unmodified JARs.

CheerpJ 4.3 Java 8: OpenJDK 8u492 Java 11: OpenJDK 11.0.31 Java 17: OpenJDK 17.0.19 Discord

Get started · Docs · Examples · Playground · Discord · Report a bug

<script src="https://cjrtnc.leaningtech.com/4.3/loader.js"></script>

CheerpJ is a Java runtime built from OpenJDK and compiled to WebAssembly. It runs Java applications, applets, Java Web Start apps and libraries on Java 8, 11 and 17, inside the browser tab. There is no Java to install, no plug-in and no server component.

Note

This repository is CheerpJ's public issue tracker and its examples. CheerpJ itself is delivered from a CDN, so there is nothing to build here. The documentation is at cheerpj.com/docs.

Two ways to use CheerpJ

I build software in Java I have Java applications to run
Bring your Java application or library to the web from the same codebase: ship a web edition of your product, or call Java libraries from JavaScript. Load CheerpJ with one script tag and run your JARs as they are. Applets, Java Web Start, Oracle Forms and EBS, or your own Java client. Install a browser extension with no changes to the page, or put CheerpJ on your own server. Retire IE mode, the old browser or Citrix, and keep the application.
Build with CheerpJ → Run Java →

Quick start

You need your JAR files, an HTML page and an HTTP server. No Java source code and no local Java install. The getting started guides cover each case step by step.

Run a Java UI in the browser

Put your JAR, or Oracle's TextDemo.jar sample, in a folder with this index.html:

<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <script src="https://cjrtnc.leaningtech.com/4.3/loader.js"></script>
  </head>
  <body>
    <script type="module">
      await cheerpjInit();
      cheerpjCreateDisplay(800, 600);
      await cheerpjRunJar("/app/my_application.jar");
    </script>
  </body>
</html>

Serve the folder and open http://localhost:8080:

npx http-server -p 8080
  • The script tag loads CheerpJ, and cheerpjInit starts it.
  • cheerpjCreateDisplay creates the area that holds the Java windows.
  • cheerpjRunJar runs the application, as java -jar does. For java -cp … com.example.Main, use cheerpjRunMain.
  • /app/ is the root of the web server the page comes from, as Java sees it. Forgetting the /app/ prefix is the most common first mistake.

See Run a Java application.

Call a Java library from JavaScript
await cheerpjInit();
const lib = await cheerpjRunLibrary("/app/pdfbox.jar");
const PDDocument = await lib.org.apache.pdfbox.pdmodel.PDDocument;

const doc = await new PDDocument();
console.log(await doc.getNumberOfPages());

See Run a Java library, library mode and the interoperability tutorial.

Important

Serve over HTTP(S), never file://: opening the page from disk doesn't work. The server must support HTTP Range requests; Python's http.server doesn't. See server setup.

Choose your path

You have Start here Example
A desktop application (Swing, AWT or console) Run a Java application SwingSet3, Swing-Browser
A Java library to call from JavaScript or TypeScript Run a Java library Interoperability
An applet on a web page you control Run a Java applet FoilSim
A Java Web Start (.jnlp) application Run a JNLP application Pitch
Oracle Forms or Oracle E-Business Suite Oracle Forms · Oracle EBS
An applet or Java Web Start app you use, on a site you don't control The CheerpJ browser extensions, for Chrome and Edge

How CheerpJ runs your Java

  1. Add CheerpJ to the page. One script tag loads the JVM and the OpenJDK runtime, from our CDN or your own server. Or install a browser extension, with no changes to the page.
  2. Start the JVM and run your JAR. CheerpJ reads your JARs and their dependencies as they are. An interpreter starts running the bytecode, and a JIT compiles the code that runs most to optimised JavaScript.
  3. It runs in the tab. A virtualised window manager draws the Swing and AWT interface with HTML elements and canvases. Files and networking go through the browser, inside its sandbox.

More in How CheerpJ works and the architecture docs.

Why CheerpJ

  • Real Java. Built from OpenJDK: the OpenJDK class library itself, not a reimplementation. Java 8, 11 and 17. Your bytecode runs unmodified, including reflection, dynamic class loading, custom class loaders and obfuscated code. No source code is needed.
  • Runs what a Java client does. Swing and AWT, files, networking and sockets, printing, audio, the clipboard and threads. Native methods can be implemented in JavaScript or compiled to WebAssembly.
  • Runs on the user's machine. Your application runs in the browser's sandbox on the user's own device, not on a server. CheerpJ is a set of static files: load it from our CDN, or host it on your own web server, including on networks with no internet access. A self-hosted deployment never needs to contact our servers.

Compatibility

Java 8 (the default), 11 and 17. Choose with cheerpjInit({ version }). The browser extensions run Java 8
Applications Desktop applications, applets, Java Web Start / JNLP, Oracle Forms and EBS, and libraries
UI Swing and AWT
Networking HTTP(S) through the browser, with its certificates and TLS policies. TCP and UDP sockets through Tailscale
Graphics OpenGL through WebGL, for LWJGL 2 applications such as Browsercraft
Browsers Chrome, Edge, Firefox and Safari
Not supported JavaFX (planned for 2027), LWJGL 3 (planned for December 2026), SWT, and pre-built native binaries (.dll, .so, .dylib)

The full tables are on the compatibility page.

Examples

The examples folder holds the projects used by the tutorials.

Example What it shows Tutorial
SwingSet3 A full Swing application SwingSet3
Swing-Browser A Swing application with network access Java browser
FoilSim-Applet A Java applet on a web page Applet
Pitch-Applet An applet launched from a JNLP file JNLP
Server-Client Two Java applications talking tab to tab Server and client
Interoperability Calling between Java and JavaScript Interoperability

Try it without installing anything

  • JavaFiddle: write and run Java in the browser.
  • Browsercraft: the original Minecraft 1.2.5 client, running unmodified in a browser tab.
  • Showcase: projects built with CheerpJ, including FlatLaf, PhET, ImageJ.js and Logisim.

Using a coding agent?

Install the CheerpJ skill. It covers converting java command lines, JARs, applets, JNLP, Oracle Forms and libraries, and the common errors:

npx skills add leaningtech/skills --skill cheerpj

In Claude Code, run /plugin marketplace add leaningtech/skills, then /plugin install cheerpj@leaningtech-skills. The skills repo covers Codex and Gemini CLI. Or point your agent at cheerpj.com/agents.md or cheerpj.com/llms.txt.

Getting help

Where Best for
Discord Questions, help getting started, and showing what you built. The CheerpJ team answers there
GitHub issues Bugs and errors in CheerpJ or the browser extensions
Contact us Licensing, commercial support and enterprise deployments
What to put in a bug report
  • The CheerpJ version (from the loader URL), or the extension and its version
  • The Java version you pass to cheerpjInit, if any
  • Your browser, its version, and your OS
  • A public URL or a small JAR that shows the problem
  • The full browser console output, from page load to the error

Test without a local Java install and with other extensions disabled. Check the FAQs first.

Licensing

CheerpJ is free for personal, educational and hobby use, and for technical evaluation by organisations of any size. One-person companies and non-commercial open-source projects can use it free with a "Built with CheerpJ" credit.

Business use needs a licence. Desktop licences cover Java applications your organisation uses, such as Oracle Forms and EBS. Application licences cover software you build with CheerpJ for customers or the public. See licensing and pricing.

Trusted in production

Over a million people ran a CheerpJ application in the last 12 months, and the CheerpJ browser extensions have more than 170,000 users (September 2026). CheerpJ is used by NASA, Ticketmaster, Moody's, ADP and many other organisations.


cheerpj.com · Discord · X · Made by Leaning Technologies

About

Real Java in the browser, built from OpenJDK. Issues and examples for CheerpJ: Java 8, 11, 17 and 21 apps, applets, JNLP and libraries, client-side.

Topics

Resources

Stars

688 stars

Watchers

24 watching

Forks

Used by

Contributors