Java: embedding script engines in an application: Is the JSR 223 (ScriptEngine) still a good solution?

StackOverflow https://stackoverflow.com/questions/5358923

  •  27-10-2019
  •  | 
  •  

Question

I want to use one or many script languages in my Java application.

From JRuby website I found that there are 3 ways:

  1. Using Java 6 (using JSR 223: Scripting)
  2. Embedding with Bean Scripting Framework (BSF)
  3. Directly calling $YOUR_SCRIPTING_ENGINE$ APIs

As I need to support more than 1 script engine, I don't think option 3 will be good enough.

When looking for solution 1. JSR 223: Scripting, I start to look for the zip archive containing all script engine integration

Download and unzip the collection of jars from the documents and files section of the site (jsr223-engines.tar.gz or jsr223-engines.zip).

But this file is nowhere on the net (dowload section of project home is empty. If I want I can download the sources and build my needed enngines integration. Sources code are looking old (2+ years for what I saw)

Is the JSR 223 still alive and a good solution to choose? If not is the Bean Scripting Framework a good alternative ? This last have a very poor documentation page and only few script languages are supported (but it is supporting most of the language I want to have)...

Was it helpful?

Solution

I've embedded sandboxed Rhino in a couple applications and found it much easier to just work directly with the Rhino code.

Unless you want to embed multiple different languages or want to deploy on VMs that already have JSR 223 jars in place, then I don't think you'll benefit much from the extra layer of abstraction.

I would strongly suggest, that you take ease of sandboxing into account when choosing a language to embed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top