Nashorn, using the CLI program jjs is commonplace. If you are using Atom as your editor, you will need a few mods to be able to invoke jjs and run your javascript from inside the editor. Here is how.
"> Nashorn, using the CLI program jjs is commonplace. If you are using Atom as your editor, you will need a few mods to be able to invoke jjs and run your javascript from inside the editor. Here is how. "> Nashorn, using the CLI program jjs is commonplace. If you are using Atom as your editor, you will need a few mods to be able to invoke jjs and run your javascript from inside the editor. Here is how. " />The love of Data, Database Engineering, Architecture, Entrepreneurship, and other assorted bits
05 November 2019
When writing Javascript using Oracle Nashorn, using the CLI program jjs is commonplace. If you are using Atom as your editor, you will need a few mods to be able to invoke jjs and run your javascript from inside the editor. Here is how.
Just a bit of quick background - when creating Javascript User Functions for Eventador SQLStreamBuilder - the best practice is to use jjs to develop the functions before importing them into Eventador. If you are using Atom as your editor, you can run these functions from inside the editor.
$HOME/.atom/packages/script/lib/grammars/javascript.js
and replace the exports.Javascript
section like this:exports.JavaScript = {
'Selection Based': {
command: '/usr/bin/jjs',
args: (context) => {
const code = context.getCode();
const tmpFile = GrammarUtils.createTempFileWithCode(code, '.js');
return [tmpFile];
},
},
'File Based': {
command: '/usr/bin/jjs',
args: ({ filepath }) => [filepath]},
};
Cmd-I
and the results will be displayed in the editor console window.