How to load cryptojs in rhino javascript

343 views
Skip to first unread message

Mary

unread,
Sep 27, 2018, 10:11:03 AM9/27/18
to mozilla-rhino
I tried load() function, but got error 'load' is not defined.

Gregory Brail

unread,
Oct 1, 2018, 3:46:00 PM10/1/18
to mozill...@googlegroups.com
 "load" is part of the built-in functions that are available in the Rhino shell, but not in the core engine by default:


You can do this in a program by creating a Context, and then creating an instance of Global to run your script in, rather than calling Context.initStandardObjects(). I don't have a great example lying around but it'd be something like this:

Context cx = Context.enter();
Scriptable scope = new Global(cx);
cx.evaluateString(scope, "print('Hello, World!);", "hello", 1, null);

On Thu, Sep 27, 2018 at 7:11 AM Mary <maryth...@gmail.com> wrote:
I tried load() function, but got error 'load' is not defined.

--
You received this message because you are subscribed to the Google Groups "mozilla-rhino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mozilla-rhin...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages