poniedziałek, 11 stycznia 2016

How to run javascript script in jvm environment?

Oracle's JDK8 comes with jjs command which runs javascript code agains nashorn build-in engine. Assumming the following piece of code
// script.js
var lines = `ls -lsa`.split("\n");
for each (var line in lines) {
          print("|> " + line);
}
After running it with the following command:
jjs -scripting script.js
We will be given with a nice listing of working directory

Brak komentarzy:

Prześlij komentarz