Login | Register
My pages Projects Communities java.net

Project home

If you were registered and logged in, you could join this project.

Summary Scripting Engines and Scripting Applications.
Categories None
License Berkeley Software Distribution (BSD) License
Owner(s) mikeg, sundararajana


Java SE 6 will contain JSR 223: Scripting for the JavaTM Platform API classes. This Framework can be used to host Script Engines in Java Applications. Sun's implementation of Java SE 6 includes a Script Engine based on Rhino: JavaScript for Java version 1.6R2

The Scripting Framework also supports third-party Script Engines that implement the JSR 223 Scripting APIs . The primary purpose of this project is to provide ScriptEngine implementations that developers can use in their Java Applications. Developers can also use the Script Engines as examples of how to implement the Scripting APIs using their own Java-based Scripting implementations.

This project also includes example applications that use the Scripting Framework. Developers are invited to participate in the project by including their own ScriptEngines and applications.

The Source Code in the project is licensed under the BSD License. The third-party scripting implementations used by several of the Script Engines are included in binary form for convenience. In some cases their licensing terms impose conditions and restrictions on software derived from them or using them. The text of each third-party license is included.

Working with the binaries

  • Download jsr223-engines.tar.gz (or jsr223-engines.zip) from "Documents & files" link.
  • gunzip/untar (or unzip) it in a directory, say $JSR223-ENGINES
  • There is one directory for each language for which jsr223 engine is available.
  • Under each directory, there is a README.TXT that has URL of the scripting language implementation. You have to download that under the lib sub-directory.
  • To try out command line usage, look for scripts under bin sub-directory.

Working with the source

Build Requirements

Steps to build

  1. CVS checkout the scripting project in a directory, say $SCRIPTING_SRC
  2. To build all script engines, use the following commands:
        cd  $SCRIPTING_SRC/engines
  3. To build a specific script engine, use the following commands:
        cd $SCRIPTING_SRC/engines/<script-engine-dir>/make

Steps to run/use

  1. cd $SCRIPTING_SRC/engines/<script-engine-dir>/bin
  2. Use the shell script (or batch file) under the above dir to run the script engine. These are wrappers over jrunscript tool shipped with JDK 6.

To use a specific script engine for language Foo in your application, you have put Foo-engine.jar file and associated jar files in $SCRIPTING_SRC/engines/Foo/lib/ in your CLASSPATH. In your Java class, you can get ScriptEngine instance using the following snippet:

    ScriptEngineManager m = new ScriptEngineManager();
    ScriptEngine fooEngine = m.getEngineByName("Foo");

Scripting applications

NetBeans scripting module

In addition to the JSR-223 script engines for many languages, we want to develop/maintain interesting/useful applications of scripting. To start, scripting support modules for NetBeans IDE have been added under applications/NetBeansModules directory.


Scriptlets are applets written in JavaScript. Developers use a pre-defined Java applet class (com.sun.scriptlet.Scriptlet) and define an applet param which identifies a JavaScript. The JavaScript code can define functions for applet's paint, init, start, stop and destroy methods [effectively "override" applet's methods with JavaScript functions]. The code for scriptlet is under applications/scriptlet directory.

SVG scripting

Batik (http://xml.apache.org/batik) script extension. This adds script tag support for any jsr-223 scripting language. So, it is possible to use any jsr-223 scripting language with SVG script tag.

Useful scripts

We want to create/maintain useful scripts in this project. To start with, we have added few scripts under scripts/javascript/ajax directory.

These include ajax.js (script to support XMLHttpRequest, XMLSerializer, DOMParser etc. for JDK 6's JavaScript engine) and two test scripts (test.js, test2.js) to test the same.

Script Engines in this project (so far!)

Language Description Implementation
AWK AWK is a general purpose language that is designed for processing text-based data, either in files or data streams. Jawk is Java-like, Awk-like reporting language. Jawk 0.14
BeanShell BeanShell is a small, free, embeddable Java interpreter with object scripting language features, written in Java. BeanShell dynamically executes standard Java syntax and extends it with common scripting conveniences such as loose types, commands, and method closures like those in Perl and JavaScript. BeanShell 2.0b5
ejs "ejs" (Embedded JavaScript) is JSP-like templating engine for JavaScript. It supports the usual <%= expr %>, <% code %> syntax. This engine is completely implemented in JavaScript. You need to use JavaScript engine to use this script engine. Implementation contained in one JavaScript file.
FreeMarker FreeMarker is a Java-based general purpose template engine. FreeMarker 2.3.8
Groovy Groovy is an agile dynamic language for the Java 2 Platform that has many of the features that people like so much in languages like Python, Ruby and Smalltalk, making them available to Java developers using a Java-like syntax. Groovy 1.0
Jaskell Jaskell is a lazy functional programming language. It stands for "Java Haskell". It features higher-order functions, function currying, string interpolation, lazy evaluation, dynamic typing. Jaskell 1.0
Java http://java.sun.com Java Compiler API (JSR 199)
JavaScript Rhino 1.6R4 based JavaScript script engine. Rhino 1.6R4
JavaScript Web Browser's native JS interpreter is wrapped as javax.script API. Note that this script engine works only under web browsers. i.e., only within Java applets. Web Browser's JS implementation (tested with Firefox 1.5.0)
Jelly Jelly is a tool for turning XML into executable code. So Jelly is a Java and XML based scripting and processing engine. Jelly borrows many good ideas from both JSP custom tags, Velocity, Cocoon, Ant. In this script engine, <script> tag has been added. Any JSR-223 compliant language may be used. Also, expressions [${xxx}] may be from any scripting language rather than Jexl alone. Jelly 1.0
JEP JEP is a Java library for parsing and evaluating mathematical expressions. JEP supports BigInteger, BigDecimal, complex, Vector/Matrix/Tensor arithmetic. JEP (Java Math Expression Parser) 2.4.0
Jexl Java Expression Language (JEXL) is an expression language engine which can be embedded in applications and frameworks. JEXL is inspired by Jakarta Velocity and the Expression Language defined in the JavaServer Pages Standard Tag Library version 1.1 (JSTL) and JavaServer Pages version 2.0 (JSP). Jexl 1.0
jst "jst" (JavaScript Templates) is JSP/ASP/PHP-like templating engine for JavaScript. This engine uses TrimPath's JavaScript Templates implementation. This script engine is implemented in JavaScript. You need to use JavaScript engine to use this script engine. TrimPath JavaScript Templates (1.0.38)
JudoScript A scripting language built atop Java, and is a powerful general-purpose programming language with intimate Java scripting support. JudoScript, or Judo for short, is a general-purpose, Java scripting and multi-domain language. A full-fledged general-purpose scripting language with full capability of Java scripting, JudoScript intimately supports most of today's key computing areas. JudoScript 0.9
JUEL JUEL stands for Java Unified Expression Language; This is an implementation of Unified Expression Language (EL) specified as a part of the JSP 2.1 standard (JSR-245) JUEL 2.1.0-rc2
OGNL OGNL stands for Object-Graph Navigation Language; it is an expression language for getting and setting properties of Java objects. You use the same expression for both getting and setting the value of a property OGNL 2.6.9
Pnuts Pnuts is a simple but powerful scripring language that is embeddable into Java applications. It has an extensible module system and a lot of ready-to-use modules. Pnuts 1.1
Python Python is a dynamic object oriented programming language that can be used for many kinds of software development. It offers strong support for integration with other languages and tools, comes with extensive standard libraries, and can be learned in a few days time. Jython 2.2b1
Ruby Ruby is the interpreted scripting language for quick and easy object-oriented programming. It has many features to process text files and to do system management tasks (as in Perl). It is simple, straight-forward, extensible, and portable. JRuby 1.0.0RC2
Scheme Scheme is a statically scoped and properly tail-recursive dialect of the Lisp programming language invented by Guy Lewis Steele Jr. and Gerald Jay Sussman. It was designed to have an exceptionally clear and simple semantics and few different ways to form expressions. A wide variety of programming paradigms, including imperative, functional, and message passing styles, find convenient expression in Scheme. SISC 1.16.6
Sleep Sleep is a Java-based scripting language heavily inspired by Perl. Sleep 2.0
Tcl Tcl (Tool Command Language) is a very powerful but easy to learn dynamic programming language, suitable for a very wide range of uses, including web and desktop applications, networking, administration, testing and many more. Open source and business-friendly, Tcl is a mature yet evolving language that is truly cross platform, easily deployed and highly extensible. Jacl 1.3.3
Velocity Velocity is a Java-based general purpose template engine. Velocity 1.5
XPath JDK already includes javax.xml.xpath package for XPath. But to extend XPath with user defined functions and variables, user needs to learn different set of interfaces/classes in this (and few other) package(s). We are adding a javax.script engine on top of javax.xml.xpath API - so that user can set variables, functions in ScriptContext and call "eval" method on ScriptEngine. Any Java method, constructor may be used as XPath extension function - no need to wrap it as "XPathFunction". JDK implementation of javax.xml.xpath is used.
XSLT JDK already includes javax.xml.transform package for XSLT. But to use XSLT, user needs to learn different set of interfaces/classes in this (and few other) package(s). We are adding a javax.script engine on top of javax.xml.transform API - so that user can set source, result in ScriptContext and call "eval" method on ScriptEngine. By default, ScriptContext's input Reader and output Writer are used for transform source and result. JDK implementation of javax.xml.transform is used.

JSR 223 script engines maintained elsewhere

Related Scripting Projects