Package Exports
- node-java-connector
- node-java-connector/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-java-connector) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
node-java-connector
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
- Install the package:
npm install node-java-connector
- 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);
});
- Add the script to your
package.json
that the JRE gets installed everytime when your package gets installed:
{
...
"scripts": {
"install": "node install.js",
}
...
}
- Use the
executeJar
method with the path to your JAR-file and optional arguments orexecuteClassWithCP
for non-executable JARs.