node-java-connector
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

node-java-connector

npm version npm bundle size

This package helps with running JAR-Files from JavaScript. If no Java is installed on the system, a openJDK version will be installed temporarily.

An example can be found at https://github.com/NLueg/node-java-connector-example.

Getting Started

  1. Install the package:
npm install node-java-connector
  1. Define a file like install.js where you deal with installing the JRE with the following content:
const njb = require("node-java-connector");

njb
  .install()
  .then((dir) => {
    // do something with the directory
  })
  .catch((err) => {
    console.log(err);
  });
  1. Add the script to your package.json that the JRE gets installed everytime when your package gets installed:
{
 ...
 "scripts": {
 "install": "node install.js",
 }
 ...
}
  1. Use the executeJar method with the path to your JAR-file and optional arguments or executeClassWithCP for non-executable JARs.

Readme

Keywords

Package Sidebar

Install

npm i node-java-connector

Weekly Downloads

1,662

Version

1.1.1

License

MIT

Unpacked Size

32.9 kB

Total Files

27

Last publish

Collaborators

  • nico.lueg