Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 4 Next »

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 Jaskell:

The output from running these scripts is:

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

See also: Accessing Groovy from Java via JSR-223

  • No labels