{"id":25772,"library":"j2ts-jre","title":"J2TS Runtime","description":"Runtime library required for code transpiled by the Java2TypeScript (J2TS) transpiler. Stable version 92.0.0 provides a set of Java-like utilities (e.g., ArrayList, HashMap) for TypeScript/JavaScript environments. Release cadence is tied to the J2TS transpiler. Key differentiator: enables running Java-derived code directly on Node.js or in browsers with minimal overhead. Only use as a dependency for J2TS projects.","status":"active","version":"92.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/datathings/java2typescript","tags":["javascript","typescript"],"install":[{"cmd":"npm install j2ts-jre","lang":"bash","label":"npm"},{"cmd":"yarn add j2ts-jre","lang":"bash","label":"yarn"},{"cmd":"pnpm add j2ts-jre","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package. No default export.","wrong":"const ArrayList = require('j2ts-jre').ArrayList","symbol":"ArrayList","correct":"import { ArrayList } from 'j2ts-jre'"},{"note":"Named export. Default import will fail.","wrong":"import HashMap from 'j2ts-jre'","symbol":"HashMap","correct":"import { HashMap } from 'j2ts-jre'"},{"note":"Do not deep-import internal paths.","wrong":"import { StringBuilder } from 'j2ts-jre/src/index'","symbol":"StringBuilder","correct":"import { StringBuilder } from 'j2ts-jre'"},{"note":"Any class from J2TS is exported from the package root.","symbol":"RuntimeExportedClass","correct":"import { RuntimeExportedClass } from 'j2ts-jre'"}],"quickstart":{"code":"import { ArrayList } from 'j2ts-jre';\n\n// Create an ArrayList and add elements\nconst list = new ArrayList<string>();\nlist.add('hello');\nlist.add('world');\nconsole.log(list.size()); // 2\n\n// Iterate\nfor (let i = 0; i < list.size(); i++) {\n  console.log(list.get(i));\n}","lang":"typescript","description":"Demonstrates creating an ArrayList, adding elements, accessing by index, and iteration."},"warnings":[{"fix":"Follow J2TS documentation for setup.","message":"Package is a runtime dependency for J2TS transpiled code. Do not manually add unless you are using the J2TS transpiler.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade both J2TS and j2ts-jre together.","message":"Breaking changes occur frequently with major version bumps due to transpiler compatibility. See J2TS changelog.","severity":"breaking","affected_versions":"<92.0.0"},{"fix":"Use alternative methods as indicated in documentation.","message":"Some Java methods may be deprecated in future versions. Check source for deprecation warnings.","severity":"deprecated","affected_versions":">=92.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install j2ts-jre'","cause":"Package not installed or missing from package.json.","error":"Cannot find module 'j2ts-jre'"},{"fix":"Use 'import { ArrayList } from 'j2ts-jre''","cause":"Incorrect import pattern (e.g., default import instead of named import).","error":"TypeError: ArrayList is not a constructor"},{"fix":"Import from the package root: 'import { ArrayList } from 'j2ts-jre''","cause":"Deep importing internal modules instead of using the main export.","error":"Module not found: Error: Can't resolve 'j2ts-jre/src/ArrayList'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}