CINXE.COM
Apache Commons BSF™ - Bean Scripting Framework
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!-- Generated by Apache Maven Doxia at Oct 17, 2011 ( $Revision: 1080083 $ ) --> <!-- $HeadURL: https://svn.apache.org/repos/asf/commons/proper/commons-skin/trunk/src/main/resources/META-INF/maven/site.vm $ --> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Apache Commons BSF™ - Bean Scripting Framework</title> <style type="text/css" media="all"> @import url("./css/maven-base.css"); @import url("./css/maven-theme.css"); @import url("./css/site.css"); </style> <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" /> <meta name="author" content="Chuck Murcko" /> <meta name="author" content="Victor Orlikowski" /> <meta name="author" content="Rony G. Flatscher" /> <meta name="Date-Revision-yyyymmdd" content="20111017" /> <meta http-equiv="Content-Language" content="en" /> <link rel="stylesheet" type="text/css" href="./css/prettify.css" media="all"/> <script src="./js/prettify.js" type="text/javascript"></script> <script type="text/javascript">window.onload=function() { prettyPrint(); }</script> </head> <body class="composite"> <div id="banner"> <div id="bannerLeft"> <a href="http://commons.apache.org/" title="Apache Commons logo"> <img src="./images/commons-logo.png" alt="Apache Commons logo"/> </a> </div><!-- id="bannerLeft" --> <div id="bannerRight"> <a href="index.html"> <img src="images/bsf_logo.jpg" alt="Commons BSF"/> </a> </div><!-- id="bannerRight" --> <div class="clear"> <hr/> </div> </div> <div id="breadcrumbs"> <div class="xleft"> <span id="publishDate">Last Published: 17 Oct 2011</span> | <span id="projectVersion">Version: 2.5.0-SNAPSHOT</span> </div> <div class="xright"> <a href="http://www.apachecon.com/" class="externalLink" title="ApacheCon">ApacheCon</a> | <a href="http://www.apache.org" class="externalLink" title="Apache">Apache</a> | <a href="../" title="Commons">Commons</a> </div> <div class="clear"> <hr/> </div> </div> <div id="leftColumn"> <div id="navcolumn"> <h5>BSF</h5> <ul> <li class="none"> <strong>About</strong> </li> <li class="none"> <a href="bsfnews.html" title="News">News</a> </li> <li class="none"> <a href="download_bsf.cgi" title="Download">Download</a> </li> <li class="none"> <a href="manual.html" title="Documentation">Documentation</a> </li> <li class="none"> <a href="faq.html" title="FAQ">FAQ</a> </li> <li class="none"> <a href="projects.html" title="Related projects">Related projects</a> </li> <li class="none"> <a href="resources.html" title="Resources">Resources</a> </li> <li class="none"> <a href="problems.html" title="Having a problem?">Having a problem?</a> </li> </ul> <h5>Project Documentation</h5> <ul> <li class="expanded"> <a href="project-info.html" title="Project Information">Project Information</a> <ul> <li class="none"> <strong>About</strong> </li> <li class="none"> <a href="integration.html" title="Continuous Integration">Continuous Integration</a> </li> <li class="none"> <a href="dependencies.html" title="Dependencies">Dependencies</a> </li> <li class="none"> <a href="distribution-management.html" title="Distribution Management">Distribution Management</a> </li> <li class="none"> <a href="issue-tracking.html" title="Issue Tracking">Issue Tracking</a> </li> <li class="none"> <a href="mail-lists.html" title="Mailing Lists">Mailing Lists</a> </li> <li class="none"> <a href="plugin-management.html" title="Plugin Management">Plugin Management</a> </li> <li class="none"> <a href="license.html" title="Project License">Project License</a> </li> <li class="none"> <a href="plugins.html" title="Project Plugins">Project Plugins</a> </li> <li class="none"> <a href="project-summary.html" title="Project Summary">Project Summary</a> </li> <li class="none"> <a href="team-list.html" title="Project Team">Project Team</a> </li> <li class="none"> <a href="source-repository.html" title="Source Repository">Source Repository</a> </li> </ul> </li> <li class="collapsed"> <a href="project-reports.html" title="Project Reports">Project Reports</a> </li> </ul> <h5>Commons</h5> <ul> <li class="none"> <a href="../" title="Home">Home</a> </li> <li class="none"> <a href="http://www.apache.org/licenses/" class="externalLink" title="License">License</a> </li> <li class="collapsed"> <a href="../components.html" title="Components">Components</a> </li> <li class="collapsed"> <a href="../sandbox/index.html" title="Sandbox">Sandbox</a> </li> <li class="collapsed"> <a href="../dormant/index.html" title="Dormant">Dormant</a> </li> </ul> <h5>General Information</h5> <ul> <li class="none"> <a href="../volunteering.html" title="Volunteering">Volunteering</a> </li> <li class="none"> <a href="../patches.html" title="Contributing Patches">Contributing Patches</a> </li> <li class="none"> <a href="../building.html" title="Building Components">Building Components</a> </li> <li class="none"> <a href="../releases/index.html" title="Releasing Components">Releasing Components</a> </li> <li class="none"> <a href="http://wiki.apache.org/commons/FrontPage" class="externalLink" title="Wiki">Wiki</a> </li> </ul> <h5>ASF</h5> <ul> <li class="none"> <a href="http://www.apache.org/foundation/how-it-works.html" class="externalLink" title="How the ASF works">How the ASF works</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/getinvolved.html" class="externalLink" title="Get Involved">Get Involved</a> </li> <li class="none"> <a href="http://www.apache.org/dev/" class="externalLink" title="Developer Resources">Developer Resources</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/sponsorship.html" class="externalLink" title="Sponsorship">Sponsorship</a> </li> <li class="none"> <a href="http://www.apache.org/foundation/thanks.html" class="externalLink" title="Thanks">Thanks</a> </li> </ul> <a href="http://www.apache.org/events/current-event.html" title="ApacheCon" class="poweredBy"> <img class="poweredBy" alt="ApacheCon" src="http://www.apache.org/events/current-event-125x125.png" /> </a> <a href="http://maven.apache.org/" title="Maven" class="poweredBy"> <img class="poweredBy" alt="Maven" src="http://maven.apache.org/images/logos/maven-feather.png" /> </a> </div> </div> <div id="bodyColumn"> <div id="contentBox"> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <div class="section"><h2>Bean Scripting Framework<a name="Bean_Scripting_Framework"></a></h2> <p> Bean Scripting Framework (BSF) is a set of Java classes which provides scripting language support within Java applications, and access to Java objects and methods from scripting languages. BSF allows one to write JSPs in languages other than Java while providing access to the Java class library. In addition, BSF permits any Java application to be implemented in part (or dynamically extended) by a language that is embedded within it. This is achieved by providing an API that permits calling scripting language engines from within Java, as well as an object registry that exposes Java objects to these scripting language engines. </p> <p> There are now two different versions of Apache BSF. These have different APIs. <br /> The original version of BSF is represented by the BSF 2.x releases (current version 2.4), and uses an API which was originally developed at IBM. <br /> The new version of Apache BSF is represent by the 3.x releases. The 3.x version uses the API defined as part of JSR-223 (javax.script), which is included in Java 1.6 onwards. However BSF 3.x will run on Java 1.4+, allowing access to JSR-223 scripting for Java 1.4 and Java 1.5. Apache BSF 3.x is also useful for Java 1.6 as it contains a command-line utility for testing JSR-223 scripts as well as some utility classes for working with XML. </p> </div> <div class="section"><h2>Supported Languages - 2.x<a name="Supported_Languages_-_2.x"></a></h2> <p> BSF 2.x supports several scripting languages currently: </p><ul> <li> <a class="externalLink" href="http://www.mozilla.org/rhino/">Javascript (using Rhino ECMAScript, from the Mozilla project)</a> </li> <li> <a class="externalLink" href="http://www-306.ibm.com/software/awdtools/netrexx/">NetRexx</a> (an extension of the IBM REXX scripting language in Java) </li> <li> <a class="externalLink" href="http://commons.apache.org/jexl/">Commons JEXL</a> </li> <li> <a class="externalLink" href="http://jython.sourceforge.net/">Python (using Jython) </a> </li> <li> <a class="externalLink" href="http://tcljava.sourceforge.net/">Tcl (using Jacl)</a> </li> <li> <a class="externalLink" href="http://xalan.apache.org">XSLT Stylesheets (as a component of Apache XML project's Xalan and Xerces)</a> </li> </ul> <p> In addition, the following languages are supported with their own BSF engines: </p><ul> <li> Java (using <a class="externalLink" href="http://www.beanshell.org/">BeanShell</a>, from the BeanShell project) </li> <li> <a class="externalLink" href="http://groovy.codehaus.org/">Groovy</a> </li> <li> <a class="externalLink" href="http://groovy.codehaus.org/Groovy+Monkey">Groovy Monkey</a> </li> <li> <a class="externalLink" href="http://www.ulfdittmer.com/jlog/index.html">JLog</a> (<a class="externalLink" href="http://jlogic.sourceforge.net/">PROLOG implemented in Java</a>) </li> <li> <a class="externalLink" href="http://jruby.codehaus.org/">JRuby</a> </li> <li> <a class="externalLink" href="http://www.judoscript.org">JudoScript</a> </li> <li> <a class="externalLink" href="http://objectscript.sourceforge.net/">ObjectScript</a> </li> <li> <a class="externalLink" href="http://www.oorexx.org/">ooRexx (Open Object Rexx)</a>, using <a class="externalLink" href="http://wi.wu-wien.ac.at/rgf/rexx/bsf4oorexx/current/">BSF4ooRexx</a>. </li> </ul> <p> Information on where to obtain scripting languages for use with BSF is available on the <a href="projects.html">Related Projects</a> page. </p> </div> <div class="section"><h2>Documentation (2.x)<a name="Documentation_2.x"></a></h2> <p> You can view the <a href="manual.html">documentation for BSF 2.4</a>. </p> <p> Documentation and examples are included in the source and binary distributions. </p> </div> <div class="section"><h2>Documentation (3.x)<a name="Documentation_3.x"></a></h2> <p> The following references describe the standard API (javax.script) which is implemented by BSF 3.x: </p><ul> <li><a class="externalLink" href="http://jcp.org/aboutJava/communityprocess/final/jsr223/index.html">JSR-223 Scripting for the Java Platform</a> - specification (PDF)</li> <li><a class="externalLink" href="http://java.sun.com/javase/6/docs/api/javax/script/package-summary.html">Javadoc for javax.script classes</a> in Java 1.6</li> <li><a class="externalLink" href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/scripting/">Scripting for the Java platform (Sun technical article)</a></li> </ul> <p> Apache BSF 3.x includes an implementation of JSR-223 (javax.script) and runs on Java 1.4 and Java 1.5. (Java 1.6 includes javax.script as standard.) Note that although the implementation follows the JSR-223 specification, it has not been tested against the JSR-223 TCK. Apache BSF 3.x can therefore not strictly be described as a compatible implementation of JSR-223, however it is believed to be complete. </p> <p> Apache BSF 3.x also includes some utility classes for working with XML. These can be used with any used with any implementation of the javax.scripting package, including the one in Java 1.6+. </p> <p> There is also a command-line utility which can be used to run scripts in any language engine which supports JSR-223. </p> <p> Note that Apache BSF does not contain any language engines; these have to be downloaded separately. Version 3.0 was shipped with a set of engine factories, however this is no longer present in later versions of BSF. This is because many languages are now provided with their own factories. <br /> Also, having all the factories in a single jar can cause problems at run-time. If other jars contain factories that implement a different version of the same language it may be difficult or impossible to choose which version is loaded. <br /> If the language implementation is not present, the factory class may fail to load; with some implementations of javax.script (e.g. Sun Java 1.6) this may prevent any factories from loading. </p> <p> An example language which includes the necessary engine factory is: <a class="externalLink" href="http://commons.apache.org/jexl/">Apache Jexl 2.0</a> (requires Java 1.5). Some other scripting languages also come with their own factories already included. For example <a class="externalLink" href="http://groovy.codehaus.org/">Groovy</a> and <a class="externalLink" href="http://jruby.org/">JRuby</a>. </p> <p> Many other languages are supported by the 3rd party engine factories available at <a class="externalLink" href="https://scripting.dev.java.net/">https://scripting.dev.java.net/</a>. This provides a combined archive from which the appropriate jar for the language can be extracted. </p> </div> </div> </div> <div class="clear"> <hr/> </div> <div id="footer"> <div class="center">Copyright © 2002-2011 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved. </div> <div class="center">Apache Commons, Apache Apache Commons BSF (Bean Scripting Framework), Apache, the Apache feather logo, and the Apache Commons project logos are trademarks of The Apache Software Foundation. All other marks mentioned may be trademarks or registered trademarks of their respective owners.</div> <div class="clear"> <hr/> </div> </div> </body> </html>