Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Groovy integrates cleanly with Wiki Markup{link:BSF|http://jakarta.apache.org/bsf/}{link} (the Bean Scripting Framework) which allows you to embed any scripting engine into your Java code while keeping your Java code decoupled from any particular scripting engine specifics.
The BSF engine for Groovy is implementated by the Wiki Markup{link:GroovyEngine|apidocs/org/codehaus/groovy/bsf/GroovyEngine.html}{link} class; however, that fact is normally hidden away by the BSF APIs. You just treat Groovy like any of the other scripting languages via the BSF API.
Note: Groovy has its own native support for integration with Java. See Embedding Groovy for further details. So you only need to worry about BSF if you want to also be able to call other languages from Java, e.g. JRuby or if you want to remain very loosely coupled from your scripting language.

...

Code Block
java
java
BSFManager.registerScriptingEngine(
	"groovy",

	"org.codehaus.groovy.bsf.GroovyEngine",

	new String[] { "groovy", "gy" }
);