A JVM written in TypeScript that runs Java 25 class files and JARs in the browser and under Node. It runs the real OpenJDK 25 class library unmodified, and its page API matches CheerpJ's, so existing pages can switch.
pnpm add @project516/java-webServe node_modules/@project516/java-web/dist/ as static files, then:
<script src="java-web.js"></script>
<pre id="console"></pre>
<script type="module">
await cheerpjInit();
await cheerpjRunJar("/app/my-app.jar"); // /app/ is the web server root
</script>cheerpjRunMain, cheerpjRunLibrary (call Java from JS), JS natives and
/files/ storage work too. See docs/browser.md.
npx @project516/java-web -cp classes Main # or: npx @project516/java-web -jar app.jarimport { runNode } from "@project516/java-web";
const code = await runNode({ classpath: ["classes"], mainClass: "Main" });See docs/node.md.
- Console apps, libraries and javac: every Java SE module, plus
jdk.compiler,jdk.httpserverand a few more. - The headless parts of
java.desktop, includingGraphics2Don aBufferedImage, with HotSpot's pixels except for text. - Sockets: real ones under Node; in the browser, loopback inside the VM and
http:/https:throughfetch. - Not yet: AWT and Swing windows, child processes, IPv6.
Details: docs/support.md.
You need Node 23.6+, pnpm, curl and bzip2 on Linux or macOS.
pnpm install
pnpm jdk # downloads the pinned JDK 25 and builds the image
pnpm test # compares programs against HotSpot
pnpm build # builds dist/More: docs/development.md.
AGPL-3.0-only. The OpenJDK class library is GPL-2.0 with the Classpath
Exception, and the bundled DejaVu Sans font has its own license; both notices
ship in dist/jdk/legal/.