Version 3 (modified by astalla, 14 years ago) (diff)


JSR-223 support in ABCL

ABCL is integrated with the Java Scripting API (JSR-223, package javax.script) which is built-in in Java 6.

This page describes the design decisions behind the ABCL JSR-223 support. It is not a description of what JSR-223 is or a tutorial on how to use it. See for example usage.

Implemented interfaces

JSR-223 defines three main interfaces, of which two (Invocable and Compilable) are optional. ABCL implements all the three interfaces - ScriptEngine and the two optional ones - almost completely. The JSR-223 API is not specific to a single scripting language, however was designed with languages with a more or less Java-like object model in mind: languages such as Javascript, Python, Ruby, which have a concept of "class" or "object" with "fields" and "methods". Lisp is a bit different, so certain adaptations were made, and in one case a method has been left unimplemented since it does not map at all to Lisp.


The main interface defined by JSR-223, javax.script.ScriptEngine, is implemented by the class org.armedbear.lisp.scripting.AbclScriptEngine. AbclScriptEngine is intended to be a singleton, even if it has a public constructor - which will probably be made protected in future versions of the engine. You can obtain an instance of AbclScriptEngine using the AbclScriptEngineFactory or by using the service provider mechanism through ScriptEngineManager (refer to the javax.script documentation).

Configuration file

At startup