There's no standardized module loading facility in JavaScript; you need to roll 
your own that'll rely on Context.compileReader and then run the resulting 
script using Script.exec in the same scope where your main script runs. You'll 
need to deal with your own caching/reloading semantics etc.

Alternatively, you can check out latest CVS version and use the CommonJS 
support in it (look for org.mozilla.javascript.commonjs.module.Require class)

Attila.

--
home: http://www.szegedi.org
twitter: http://twitter.com/szegedi
weblog: http://constc.blogspot.com

On 2010.03.02., at 17:39, doles wrote:

> Hello,
> 
> How does one load a library such as jQuery or prototype into the rhino
> context when running as an embedded app within a java program? I am
> using Java 6, rhino 1.7R2. I can totally run functions and eval
> arbitrary code, but I cant find any documentation or even class files
> in the source tree that scream to me "use me to load libraries". So
> what class/method in Rhino actually satisfies the load (file)
> semantics in the command line?
> 
> Thanks for your attention!
> 
> Sachin





_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to