开发者

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

开发者 https://www.devze.com 2023-02-18 20:56 出处:网络
I want to use one or many script languages in my Java application. From JRuby website I found that there are 3 ways:

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. Di开发者_开发技巧rectly 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)...


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消