Beanshell represents a dynamic script language for the Java VM. The Java scripting language support is useful for dynamic aspects of your software. For example the developer would have a possibility to change or affect the software runtime behaviour.
The following example describes how to embed and execute beanshell scripts inside of your software:
Interpreter interpreter = new Interpreter();
interpreter.set("startTime", new Date());
String script =
"multiply( x, y ) {" +
" return x * y;"+
"}" +
"multiplyResult = multiply(2, 2);" +
"print(multiplyResult);" +
"print(startTime)";
interpreter.eval(script);
Regards
Rafael Sobek

Beanshell Example
Languages , Technologies and Visions. Topics: Visions, Architecture Issues, Programming Languages , … Search: January 01, 2010 Go here to read the rest: Beanshell Example Tags: