Re: Adding imports?

Brian Hawkins <brianhks-BYHubErIwDGZvNlLnfxc/[email protected]> Thu, 20 Jan 2005 05:57:31 -0700
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
I would try this.  Before calling interpreter.source(file) on your 
script, call interpreter.eval("import java.io.*") or whatever it is you 
want to import.

Brian

Darren Govoni wrote:

> Hi,
>    I was trying to do something I thought trivial. I want to load a 
> script into an interpreter instance, but I want to prime the 
> interpreter with import packages so the script doesn't have to. I 
> tried reloadPackages() with the 'new' packages the script will need, 
> but that didn't work.  Any tips? I want to avoid manipulating the 
> script string to do this.
>
> thanks!
> Darren 



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl