Find JSRs
Submit this Search

Ad Banner

JSRs: Java Specification Requests
JSR 274: The BeanShell Scripting Language

This JSR has been Dormant
Reason: The Executive Committee voted to list this JSR as dormant in June 2011.

Original Java Specification Request (JSR)

Identification | Request | Contributions

Section 1. Identification

Submitting Member: Patrick Niemeyer

Name of Contact Person: Patrick Niemeyer

E-Mail Address:

Telephone Number: +1 314 504 7289

Fax Number: +1 314 367 7289

Specification Lead: Patrick Niemeyer

E-Mail Address:

Telephone Number: +1 314 504 7289

Fax Number: +1 314 367 7289

Initial Expert Group Membership:

Patrick Niemeyer (individual)
Sun Microsystems
Apache Software Foundation
Google Inc.

Supporting this JSR:

Patrick Niemeyer (individual)
Doug Lea (individual) Sun Microsystems
Apache Software Foundation
Google Inc.

Section 2: Request

2.1 Please describe the proposed Specification:

This specification will standardize BeanShell, a Java syntax compatible scripting language for the Java platform.

The BeanShell language bridges Java into the scripting domain in a natural way, allowing developers to mix static Java syntax with scripting conventions such as optional typing, simple closures, dynamic commands, and other conveniences.

BeanShell is a VM hosted language, supporting dynamic execution of the full Java grammar and semantics as well as transparent access to Java objects and APIs. Additional scripting and convenience features are brought into the language as a strict superset of the the Java language syntax. In this way BeanShell attempts to minimize both the syntactic and runtime barriers between Java application code and scripts, easing development and facilitating migration between scripts and static Java.

This specification will standardize the BeanShell language syntax and a minimal set of core commands and environmental components.

2.2 What is the target Java platform? (i.e., desktop, server, personal, embedded, card, etc.)

The JSR is targeted at the J2SE platform, however the small size of the reflection based implementation (approximately 150K) may make it applicable to smaller Java profiles as well.

2.3 The Executive Committees would like to ensure JSR submitters think about how their proposed technology relates to all of the Java platform editions. Please provide details here for which platform editions are being targeted by this JSR, and how this JSR has considered the relationship with the other platform editions.

This JSR is targeted for J2SE, however the lightweight nature of reflection based implementations, as demonstrated by the RI, may make them applicable to smaller profiles as well.

Should this JSR be voted on by both Executive Committees?


2.5 What need of the Java community will be addressed by the proposed specification?

While there exist many scripting environments for Java, the Java platform currently lacks a standardized, "native" Java scripting language which supports dynamic evaluation of Java code as well as common scripting language conventions.

Scripting of the Java platform lends itself to a wide variety of uses including rapid prototyping, application extension, configuration, testing, and dynamic deployment. The standardization of BeanShell in the J2SE will greatly enhance the Java platform capabilities and bring it on par with scripting capabilities in other, comparable VM based platforms.

BeanShell complements existing technologies in the J2SE, as more and more often core Java APIs are implementing mini-parsers to achieve elements of scripting for dynamic behavior. Examples of this include the java.beans package EventHandler and XMLEncoder classes.

It has also been noted (Gosling) that configuration files tend to grow in features until they become programming languages. BeanShell scripts can be used in a declarative way as a replacement for properties files, providing the advantage of a true tree structure and offering the option of procedural control structures, object construction, and scripted initialization behavior, all with standard Java syntax.

Finally, JSR-223 provides a standardized mechanism for scripted pages in web applications. The inclusion of BeanShell in the J2SE will provide a standardized, dynamic language for page construction and web services that is implicitly understood by all Java developers.

2.6 Why isn't this need met by existing specifications?

With the exception of ECMA/JavaScript, there is currently no standardized Java-like scripting language. JSR-223, the javax.script API provides a standard interface for such a scripting language, but no implementations. BeanShell is a mature language which has been in widespread use in commercial and open source products for many years. Its small size and Java syntax compatibility make it a natural choice to fill this need in the Java platform.

2.7 Please give a short description of the underlying technology or technologies:

The existing RI is based on the core reflection API and uses a small amount of bytecode generation where non-interface class type generation is necessary. The parser is based on the Java grammar and generated with the JavaCC parser generator. Through the use of dynamic proxies and generated delegate classes, BeanShell scripts can appear to Java code as ordinary Java classes and interfaces, while remaining fully dynamic.

The BeanShell runtime environment supports features such as dynamic classpath management with fine grained class reloading, dynamic command loading, advanced scoping and namespace management, callstack manipulation, and detailed error reporting.

Th open source BeanShell project has demonstrated that an implementation of the language, compatible with the full Java syntax, can be implemented in approximately 150K of code (comparable to some Swing components and their supporting classes).

Furthermore, the architecture of the RI is modular, allowing varying levels of functionality on Java versions as far back as version 1.1.

2.8 Is there a proposed package name for the API Specification? (i.e., javapi.something, org.something, etc.)

javax.script.beanshell ?

2.9 Does the proposed specification have any dependencies on specific operating systems, CPUs, or I/O devices that you know of?


2.10 Are there any security issues that cannot be addressed by the current security model?

No. Dynamic evaluation in BeanShell is built upon current reflective and classloading features of the Java language.

2.11 Are there any internationalization or localization issues?

It is unlikely, as BeanShell employs standard Java semantics and APIs for character handling.

2.12 Are there any existing specifications that might be rendered obsolete, deprecated, or in need of revision as a result of this work?

No. Although we may provide useful feedback on JSR-223, the javax.script API.

2.13 Please describe the anticipated schedule for the development of this specification.

We would like to have a draft review in Q3 or Q4 2005.

2.14 Please describe the anticipated working model for the Expert Group working on developing this specification.

The expert group will utilize regular conference calls and email to discuss issues. The spec lead will offer proposals and try to move the work forward through consensus. The spec lead will post regular updates to the community as appropriate regarding progress and asking for input on specific topics.

2.15 It is important to the success of the community and each JSR that the work of the Expert Group be handled in a manner which provides the community and the public with insight into the work the Expert Group is doing, and the decisions that the Expert Group has made. The Executive Committees would like to ensure Spec Leads understand the value of this transparency and ask that each JSR have an operating plan in place for how their JSR will address the involvement of the community and the public. Please provide your plan here, and refer to the Spec Lead Guide for a more detailed description and a set of example questions you may wish to answer in your plan.

The BeanShell JSR Expert Group will take advantage of the existing BeanShell user and developer community, as well as an updated BeanShell web site, mailing lists, wiki, and bug tracking system to maximize transparency of the process.

The BeanShell developer community routinely comments on proposals for future enhancements and will continue to be involved in the progress of the expert group via regular postings. The EG will also solicit feedback from developers who have been using BeanShell in their projects for many years.

2.16 Please describe how the RI and TCK will de delivered, i.e. as part of a profile or platform edition, or stand-alone, or both. Include version information for the profile or platform in your answer.

The RI and TCK will be delivered as stand-alone packages and available for inclusion in a future J2SE release. The current RI provides, with varying degrees of functionality, support for legacy Java platforms JRE version 1.1 and greater. However it is likely that the JSR RI would choose a later J2SE version (e.g. JRE 1.3) as a minimum supported environment.

2.17 Please state the rationale if previous versions are available stand-alone and you are now proposing in 2.13 to only deliver RI and TCK as part of a profile or platform edition (See sections 1.1.5 and 1.1.6 of the JCP 2 document).

No previous standardized version is available.

2.18 Please provide a description of the business terms for the Specification, RI and TCK that will apply when this JSR is final.

The reference implementation and TCK will be freely available for use and binary redistribution under a license to be decided. The BeanShell group has made a strong commitment that the JSR specification, RI, and TCK will be licensed under terms amendable to distribution with the J2SE.

Section 3: Contributions

3.1 Please list any existing documents, specifications, or implementations that describe the technology. Please include links to the documents if they are publicly available.

The existing open source BeanShell language implementation and documentation are contributed and will serve as a basis for this JSR:

Please see also the usage of BeanShell in well known applications such as OpenOffice, Emacs JDE, Ant, jEdit, Weblogic, NetBeans/Forte, etc.

3.2 Explanation of how these items might be used as a starting point for the work.

The open source BeanShell project will provide a reference implementation and a TCK for the language. The BeanShell developer community and supporting JCP members will be asked to contribute to the effort.