Hm. That might work - not sure. But ideally I would be able to do this in Java, so that it could be independent of any particular script engine. In fact, I may want to run multiple script engines at once, all of which should be able to use the same imports.
On Jun 11, 2009, at 1:39 PM, Oti wrote: > > Greg, > > maybe http://java.sun.com/javase/6/docs/api/javax/script/ScriptContext.html > would do the trick. > Run a small script with the imports you want, populate the script > context, and pass it into the 'real' script. > But I have to confess I never tried. > > best wishes, > Oti. > > On Thu, Jun 11, 2009 at 7:31 PM, Greg Brown<gkbr...@mac.com> wrote: >> >> Hi all, >> >> Is there a way to programmatically import a class or package into a >> script engine such that the script itself does not need to? >> Basically, >> I want to pre-populate the script's namespace with the imports. I >> looked for an "importClass()" or "importPackage()" method in the >> ScriptEngine and ScriptEngineManager classes, but I couldn't find >> one. >> Any suggestions? >> >> Thanks, >> Greg Brown >> >>> >> > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "JVM Languages" group. To post to this group, send email to jvm-languages@googlegroups.com To unsubscribe from this group, send email to jvm-languages+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/jvm-languages?hl=en -~----------~----~----~----~------~----~------~--~---