Scripting using JSR 223

The code to define rules in a scripting languages is available, however it turned out that using Java was simpler for the current rules. Therefore both letter match example and particle analyzer are currently using Java for rule definition.

Goals for scripting

  • It should be possible to add new scripts dynamically
  • So you should be able to get the same engine back

Installing Groovy or other Scripting engines for JSR 223

This is one thing that does not work directly with Maven

In other to get it to work you have to download from

After that you have to unpack it, and install it into the Maven repository:

mvn install:install-file -Dfile=groovy-engine.jar -DgroupId=org.codehaus.groovy -DartifactId=groovy-engine -Dversion=1.5.1 -Dpackaging=jar


The class ScriptEngineCache establish connection to the scripting engines, by name of the language.

There is a static method call to get a new scripting engine for a scripting language.

Normally it will get the same scripting engine for a scripting language.