j4ts is a partial translation of the Java standard library (JRE) to JavaScript, forked from GWT's Java emulation and transpiled via JSweet. This NPM package (j4ts) provides the generated JavaScript and TypeScript definitions for use in JavaScript/TypeScript projects. Currently at version 0.7.2, it targets JSweet v2 and requires at least Java 8. It offers core Java collections, utilities, and NIO-like buffers. The package is ESM-compatible since v0.7.x. Compared to other Java-to-JS solutions (e.g., GWT, CheerpJ), j4ts is lightweight and designed for gradual migration of Java code to TypeScript. Release cadence is irregular, driven by j4ts upstream.
npm install j4tsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates usage of core Java collections (ArrayList, HashMap, HashSet) imported from j4ts, with TypeScript generics.
Update imports to use ES module syntax: import { ... } from 'j4ts'Check the exact j4ts version in the package's README or commit history.
Use j4ts >=0.5.0 with JSweet v2.
Check the j4ts GitHub repository for supported classes before migrating.
Run `npm install j4ts` (or `yarn add j4ts`). Ensure tsconfig.json includes 'node_modules/@types' or the package's types are correctly configured.
Confirm j4ts is in your dependencies. If using Webpack, ensure 'resolve.modules' includes 'node_modules'. Also check that the package.json's 'main' field points to the correct file (j4ts.js).
No dependency data recorded yet.