Search notes:

jrunscript

jrunscript is a command line script shell whose default language is JavaScript (or more specifically JSR-223).
Apparently, the jrunscript executable is found in a JDK under its bin directory.

Examples

jrunscript -e "print('Hello world: ' + (21 * 2))"
jrunscript -e "cat('http://renenyffenegger.ch/notes/development/languages/JavaScript/jrunscript/index')"
js> fileRegex = 'pdf$'
pdf$
js> find('.', fileRegex, function(fileName) { echo(fileName); })
...
...
...
var proc = java.lang.Runtime.getRuntime().exec("c:\\Program Files\\Mozilla Firefox\\firefox.exe http://www.renenyffenegger.ch")
proc.waitFor()

Passing parameters to scripts

The script (abc.js)
for (var i in arguments) {
  echo (arguments[i]);
}
jrunscript abc.js foo bar baz

See also

jjs, which is the recommended tool to invoke the Nashorn scripting engine.
The javax.script Java package.
JavaScript

Index