package.html revision 2365
1821N/A<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
1821N/A<html>
3909N/A<head>
1821N/A<!--
1821N/ACopyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
1821N/ADO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1821N/A
2362N/AThis code is free software; you can redistribute it and/or modify it
1821N/Aunder the terms of the GNU General Public License version 2 only, as
2362N/Apublished by the Free Software Foundation. Oracle designates this
1821N/Aparticular file as subject to the "Classpath" exception as provided
1821N/Aby Oracle in the LICENSE file that accompanied this code.
1821N/A
1821N/AThis code is distributed in the hope that it will be useful, but WITHOUT
1821N/AANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1821N/AFITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1821N/Aversion 2 for more details (a copy is included in the LICENSE file that
1821N/Aaccompanied this code).
1821N/A
1821N/AYou should have received a copy of the GNU General Public License version
1821N/A2 along with this work; if not, write to the Free Software Foundation,
2362N/AInc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
2362N/A
2362N/APlease contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1821N/Aor visit www.oracle.com if you need additional information or have any
1821N/Aquestions.
1821N/A-->
1821N/A
1821N/A</head>
1821N/A<body bgcolor="white">
1821N/A<p>The scripting API consists of interfaces and classes that define
1821N/AJava <font size=1><sup>TM</sup></font> Scripting Engines and provides
1821N/Aa framework for their use in Java applications. This API is intended
1821N/Afor use by application programmers who wish to execute programs
1821N/Awritten in scripting languages in their Java applications. The
1821N/Ascripting language programs are usually provided by the end-users of
1821N/Athe applications.
1821N/A</p>
1821N/A<p>The main areas of functionality of <code>javax.script</code>
1821N/Apackage include
1821N/A</p>
1821N/A<ol>
1821N/A <li><p><b>Script execution</b>: Scripts
3589N/A are streams of characters used as sources for programs executed by
1821N/A script engines. Script execution uses
4632N/A {@link javax.script.ScriptEngine#eval eval} methods of
4632N/A {@link javax.script.ScriptEngine ScriptEngine} and methods of the
4632N/A {@link javax.script.Invocable Invocable} interface.
4632N/A </p>
4632N/A <li><p><b>Binding</b>: This facility
3589N/A allows Java objects to be exposed to script programs as named
1821N/A variables. {@link javax.script.Bindings Bindings} and
1821N/A {@link javax.script.ScriptContext ScriptContext}
1821N/A classes are used for this purpose.
1821N/A </p>
1821N/A <li><p><b>Compilation</b>: This
1821N/A functionality allows the intermediate code generated by the
1821N/A front-end of a script engine to be stored and executed repeatedly.
1821N/A This benefits applications that execute the same script multiple
1821N/A times. These applications can gain efficiency since the engines'
1821N/A front-ends only need to execute once per script rather than once per
1821N/A script execution. Note that this functionality is optional and
1821N/A script engines may choose not to implement it. Callers need to check
1821N/A for availability of the {@link javax.script.Compilable Compilable}
1821N/A interface using an <I>instanceof</I> check.
1821N/A </p>
1821N/A <li><p><b>Invocation</b>: This
1821N/A functionality allows the reuse of intermediate code generated by a
1821N/A script engine's front-end. Whereas Compilation allows entire scripts
1821N/A represented by intermediate code to be re-executed, Invocation
1821N/A functionality allows individual procedures/methods in the scripts to
1821N/A be re-executed. As in the case with compilation, not all script
1821N/A engines are required to provide this facility. Caller has to check
1821N/A for {@link javax.script.Invocable Invocable} availability.
1821N/A </p>
1821N/A <li><p><b>Script engine discovery and Metadata</b>: Applications
1821N/A written to the Scripting API might have specific requirements on
1821N/A script engines. Some may require a specific scripting language
1821N/A and/or version while others may require a specific implementation
1821N/A engine and/or version. Script engines are packaged in a specified
1821N/A way so that engines can be discovered at runtime and queried for
1821N/A attributes. The Engine discovery mechanism is based on the Service
1821N/A discovery mechanism described in the <b>Jar File Specification</b>.
1821N/A Script engine implementing classes are packaged in jar files that
1821N/A include a text resource named
1821N/A <b>META-INF/services/javax.script.ScriptEngineFactory</b>. This
1821N/A resource must include a line for each
1821N/A {@link javax.script.ScriptEngineFactory ScriptEngineFactory}
1821N/A that is packaged in the jar file.
1821N/A {@link javax.script.ScriptEngineManager ScriptEngineManager}
1821N/A includes
1821N/A {@link javax.script.ScriptEngineManager#getEngineFactories getEngineFactories} method to get all
1821N/A {@link javax.script.ScriptEngineFactory ScriptEngineFactory} instances
1821N/A discovered using this mechanism. <code>ScriptEngineFactory</code> has
1821N/A methods to query attributes about script engine.
1821N/A </p>
1821N/A</ol>
1821N/A
1821N/A@since 1.6
1821N/A
1821N/A</body>
1821N/A</html>
1821N/A