https://github.com/rx14/java-find
NPM package to find and list java installations, and their metadata.
https://github.com/rx14/java-find
java java-installation javascript nodejs typescript
Last synced: about 1 year ago
JSON representation
NPM package to find and list java installations, and their metadata.
- Host: GitHub
- URL: https://github.com/rx14/java-find
- Owner: RX14
- License: mit
- Created: 2016-02-15T00:01:04.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-16T23:15:59.000Z (about 10 years ago)
- Last Synced: 2025-02-06T04:39:34.634Z (about 1 year ago)
- Topics: java, java-installation, javascript, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 68.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# java-find
Node module for listing java installations, and finding their metadata.
## Installation
```
npm install java-find --save
```
## Usage
Example:
```javascript
var javaFind = require("java-find");
var child_process = require("child_process");
javaFind.getJavas().then(javas => {
javas
.filter(java => java.arch == 'x64')
.forEach(java => {
child_process.execFile(java.path, ["-jar", "MyJar.jar"]);
});
});
```
Calling `gatJavas()` will return a promise of an array of java version objects.
Java version objects looks like this:
```javascript
{
path: "/usr/bin/java",
arch: "x86", // or x64
version: { // 1.8.0_74 (Java 8)
major: 1,
minor: 8,
patch: 0,
update: 74
}
}
```
You can also use the `setDebug` method to direct debug logging:
```js
javaFind.setDebug(debug => {
console.log(debug);
})
```