views:

223

answers:

4

Hi all,

Currently researching Bean Shell.

I would like to get some input as to what types of programming tasks I would consider using Bean Shell?

...And what could replace Bean Shell for that task.

Thanks all,

+2  A: 

We've used BeanShell as a lightweight command line interface to manage an application. We exposed all our services over JMX and then defined a series of BeanShell commands that we used to interact with the system.

Kevin
+1  A: 

BeanShell is often used as a debugging and testing tool. If you have created a Java system for example and you would like to test its behavior under various conditions and with different input or even under stress load, you could write some scripts to do the job.

Another common use is to enhance your application with a scripting environment. This is what jEdit is doing for example.

More uses of BeanShell are described in the projects homepage.

kgiannakakis
+2  A: 

If you want to add scripting capabilities to your Java-based program, BeanShell is a decent choice. If you want to have what amounts to a debug console in your Java-based program, BeanShell again can fit that bill. If you want to write macros for jEdit, BeanShell is the most common choice. All these three use cases have been mentioned before by Kevin and kgiannakakis, though.

What has not been mentioned by them is the second part of your question: what can replace it.

Replacements for this tool can include:


Edited to add:

JUST MY correct OPINION
+1  A: 

If you want to allow others to customize or quickly build on top of your application viz. like macros. Personally I find that if you want to do this kind of thing, Groovy is a much better choice. Personally I find that Beanshell does not offer anything more that what 'native' Java offers.

Groovy offers everything that Java offers and on top of that meta-programming, closure, etc. It's in active development which I can't say for Beanshell.

If you are looking to build some sort of a DSL for your scripting/macro environment, then its really easy to do with Groovy.

It's also JSR-223 compliant, so in theory, if you decide to switch scripting engine to say Scala, then its easier (of course in real life things are never that simple ;-)). One other reason I use Groovy as a scripting engine, you only need to add 1 JAR file in $GROOVY_HOME/embeddable/groovy-all-1.x.x.jar.

Chuk Lee