Subj : Re: Calling a compiled script with arguments To : netscape.public.mozilla.jseng From : redcoat Date : Fri Dec 17 2004 11:09 am Hi Igor, Don't mean to be thick...but can't see a way to do the last step! Once it's compiled etc., I can open a stream to it, but how do I instantiate it as a Script object from within my Java code so I can then execute it? I'm guessing there's a method I'm not seeing...? Many thanks, David Igor Bukanov wrote: > redcoat wrote: > > If the script is already compiled in a file, is there a way to "load" > > it and then execute it with different variables? > > You can compile script to JVM class file using either JS compiler tool, > http://www.mozilla.org/rhino/jsc.html or via ClassCompiler, > http://www.mozilla.org/rhino/apidocs/org/mozilla/javascript/optimizer/ClassCompiler.html > , from Java program. Then you can load the class and instantiate it > which gives Script instance that you can use as in the above example. > > Regards, Igor .