Brings together https://github.com/raulgomis/dynamic-java-compiler and https://github.com/joeferner/node-java to dynamically run Java in a node module.
Inspired by https://github.com/tjanczuk/edge
$ brew install caskroom/cask/brew-cask
$ brew tap caskroom/homebrew-versions
$ brew cask install java8
https://chocolatey.org/install
choco install javaruntime
In ES6 you can use template strings to write multiline Java code.
var cliff = require('cliff');
var helloWorld = cliff.func(`
public class HelloWorld implements Runnable {
String input;
public HelloWorld(String input) {
this.input = input;
}
public void run() {
System.out.println("Hello " + this.input + " World!");
}
}
`);
helloWorld('JavaScript', function (error, result) {
if (error) throw error;
});
No Java Runtime present, requesting to install
Review: joeferner/node-java#90
Run: export “JAVA_HOME=\$(/usr/libexec/java_home)”