{"id":25971,"library":"n4js-cli","title":"N4JS CLI","description":"Command-line interface for the N4JS language, including the compiler and build tools. Current version is 0.37.9, with monthly releases following the N4JS project cadence. It provides a CLI to compile N4JS code to JavaScript, and supports custom runtimes. Differentiators include deep integration with the Eclipse ecosystem and a static type system targeting JavaScript. Note: this is a niche tool; for mainstream use, consider TypeScript or other transpilers.","status":"active","version":"0.37.9","language":"javascript","source_language":"en","source_url":"https://github.com/eclipse/n4js#master","tags":["javascript"],"install":[{"cmd":"npm install n4js-cli","lang":"bash","label":"npm"},{"cmd":"yarn add n4js-cli","lang":"bash","label":"yarn"},{"cmd":"pnpm add n4js-cli","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"N4JS CLI wraps a Java-based compiler (n4jsc.jar); requires Java Runtime Environment (JRE) 8 or later to execute the jar.","package":"java","optional":true}],"imports":[{"note":"n4js-cli is a CLI tool, not a library. Do not import it in JavaScript/TypeScript code.","wrong":"import { n4js } from 'n4js-cli';","symbol":"n4jsc.jar","correct":"n4js-cli invokes the Java CLI; no import in JS/TS code. Use as a command-line tool via `npx n4js-cli`."},{"note":"It's a CLI binary, not a Node.js module. Use globally or via npx.","wrong":"const n4js = require('n4js-cli');","symbol":"n4js-cli (global command)","correct":"npm install -g n4js-cli then run `n4js-cli compile`"}],"quickstart":{"code":"// n4js-cli is a CLI tool, not a library.\n// Install globally:\n// npm install -g n4js-cli\n// Then compile N4JS files:\n// n4js-cli compile src/ -d out/\n// Alternative using npx:\n// npx n4js-cli compile src/ -d out/","lang":"typescript","description":"Demonstrates installing n4js-cli globally and compiling N4JS source files to JavaScript."},"warnings":[{"fix":"Install JRE 8 or later and ensure java is in PATH.","message":"n4js-cli requires Java Runtime Environment (JRE) 8+ to execute the underlying n4jsc.jar.","severity":"gotcha","affected_versions":"all"},{"fix":"Use it via command line: `npx n4js-cli` or global install.","message":"The package is a CLI tool; it cannot be imported as a JavaScript module.","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to latest version and refer to current CLI help: `n4js-cli --help`","message":"Older versions (pre-0.25) used a different command structure; ensure documentation matches installed version.","severity":"deprecated","affected_versions":"<0.25"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure n4jsc.jar is present in the package or set N4JSC_JAR to a valid path/URL.","cause":"n4jsc.jar is missing or corrupted; environment variable N4JSC_JAR not set correctly.","error":"Error: Could not find or load main class org.eclipse.n4js.n4jsc.Main"},{"fix":"Install globally: `npm install -g n4js-cli` or use npx: `npx n4js-cli`","cause":"n4js-cli not installed globally or not in PATH.","error":"n4js-cli: command not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}