Skip to end of metadata
Go to start of metadata

JSR-223 is designed to allow Java access to many scripting languages. This means that it also provides hooks for Groovy to those other languages.

JSR-223 comes with Java 6. Here is how you can use it. First we define a script manager:

Now, we can call out to JavaScript:

Or JRuby:

Or Jython:

Or Clojure:

Or Jaskell:

The output from running these scripts is:

javascript: 24.0
jruby: 24
jython: 24
clojure: 24
jaskell: 24

See also: Accessing Groovy from Java via JSR-223

  • No labels