ESJava (v0.0.8) is an experimental transpiler that converts Java source code to ES6 (ES2015) JavaScript. It targets ES6 features such as classes, arrow functions, and static getters. Release cadence is low; the project has not seen updates since 2016. Compared to other Java-to-JS tools like GWT or J2CL, ESJava is a lightweight, single-pass transpiler focused on syntactic translation without runtime libraries. It is primarily a proof-of-concept for converting small Java programs, with limited support for Java standard library or advanced language features.
npm install esjavaNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates converting a simple Java class with a main method to ES6 JavaScript using the compile function.
Consider using modern alternatives like J2CL or TeaVM for production use.
Avoid using Java standard library classes that are not ES6 equivalents; manually implement or polyfill missing functionality.
Be aware that static final fields are not truly immutable across subclasses; use Object.defineProperty for stricter immutability if needed.
Use the programmatic API (import { compile } from 'esjava') instead of the CLI.Install the package: npm install esjava. If using require, switch to import or use dynamic import().
Use import instead of require, or set type: module in package.json.