Re: Loading .java Files

<[email protected]> Sun, 26 Jun 2011 14:23:39 +0200
Newsgroups gmane.comp.java.beanshell.user
Message-ID <3C853979208A42B881777D7823B912E5@msrvcn04>
> Ok you are using "eval".  The terminology ".java" confused me.
> You are loading  a "beanshell" file  not a "java" file.  
> Although they are
> often similar.

The only reason why I want to use .java-Files is that I can edit them in my
IDE with full IDE-support (autocomplete, syntax check etc).

> If you want to invoke a non-static method in a class you do 
> it the same way
> in beanshell as you do in java.
> you need to instantiate the class to invoke the method.
>     
>     new Foo().bar()

I do not call the Bsh-class from Bsh, I call it from Java.

> I dont think you can do this with BSHMethod.invoke()
> (You can with eval)
> 
> My prefered method of executing bsh from within java is to 
> use the Interface
> methods.
>  e.g.
>      (ICampaignScript) 
> mInterpreter.getInterface(ICampaignScript.class);
> 
> then you can call bsh methods directly via the interface.

But my Bsh-Class does not implement an interface.

> but again this only calls 'top level' methods.   To create 
> classes and call
> them you need to run eval() or to expose a top level method 
> which calls
> them.

What do you mean with "top level"?



------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2