npm-java-runner

[![NPM](https://img.shields.io/npm/v/npm-java-runner.svg?style=flat-square)](https://www.npmjs.com/package/npm-java-runner)

Apache 2 19 个版本
安装
npm install npm-java-runner
yarn add npm-java-runner
pnpm add npm-java-runner
bun add npm-java-runner
README

NPM Java Runner

NPM

  • Include configured jar inside the NPM-package.
  • Provide a layer, delegating all arguments, so that the jar is runnable with npx.

So that you can create a command line tool with Java and distribute it as an NPM package.

Usage

Create an index.js with:

#!/usr/bin/env node
require('npm-java-runner/lib/index').run(__dirname);

Create package.json with:

{
  "name": "NAME",
  "runnable-jar-regexp": ".*build/libs/.*\\d+\\.\\d+\\.\\d+\\.jar",
  "files": ["build/libs"],
  "bin": "./index.js",
  "dependencies": {
    "npm-java-runner": "a.b.c"
  }
}

If you release this (npm publish), you will be able to run your jar with:

npx NAME --whatever arguments

Examples

版本列表
2.0.0 2025-10-07
1.0.2 2022-09-01
1.0.1 2022-01-26
0.0.17 2021-11-21
0.0.16 2021-11-21
0.0.15 2021-11-21
0.0.14 2021-11-20
0.0.13 2021-11-20
0.0.12 2021-11-20
0.0.11 2021-11-20
0.0.10 2021-11-20
0.0.9 2021-11-20
0.0.8 2021-11-20
0.0.7 2021-11-20
0.0.6 2021-11-20
0.0.5 2021-11-20
0.0.4 2021-11-20
0.0.3 2021-11-20
0.0.2 2021-11-20