Skip to end of metadata
Go to start of metadata

Releases of Scripting Engines

The JobScheduler supports different scripting engines:

The scripting engines are available as follows:

  • The SpiderMonkey engine is only available for 32 bit JobScheduler. It is selected by <script language="javascript"> and <script language"spidermonkey">
  • The Rhino engine is available for 32 bit and 64 bit. It is selected by <script language="javax.script:rhino">, <script language="javax.script:JavaScript"> and <script language="javax.script:ECMAscript"/> for a JRE up to 1.7
  • The Nashorn engine is available for 32 bit and 64 bit. It is selected by <script language="javax.script:JavaScript"> and <script language="javax.script:ECMAscript"/> for a JRE starting from 1.8
  • The "Rhino (with Beans)" / "Nashorn (with Beans)" engine is available for 32 bit and 64 bit. It is selected by <script language"java:javascript">

Language

Used Engine on 32 Bit JobScheduler

Used Engine on 64 Bit JobScheduler

Available in
JobScheduler Release

spidermonkey

SpiderMonkey

All releases, only 32 bit

javascript

SpiderMonkey

All releases, only 32 bit

javax.script:rhino

Rhino (up to JRE 1.7 only)

Rhino (up to JRE 1.7 only)

Starting from 1.5
javax.script:JavaScript

up to JRE 1.7: Rhino
starting from JRE 1.8: Nashorn

up to JRE 1.7: Rhino

starting from JRE 1.8: Nashorn
Starting from 1.5
javax.script:ECMAscript

up to JRE 1.7: Rhino
starting from JRE 1.8: Nashorn

up to JRE 1.7: Rhino

starting from JRE 1.8: Nashorn
Starting from 1.5

java:javascript

JRE 1.7: Rhino (with Java beans layer)
JRE 1.8: Nashorn (with Java beans layer)

JRE 1.7: Rhino (with Java beans layer)
JRE 1.8: Nashorn (with Java beans layer)

Starting from 1.5

If you want to migrate a Javascript for SpiderMonkey to a 64 bit JobScheduler then in most cases you just have to modify the language attribute to <script language="java:javascript">. This works within limits.

Migration Strategies

Migrating JavaScript from Spidermonkey to Rhino

  • We recommend to change the JavaScript to the Rhino syntax. Then it works properly with 32 bit and 64 bit JobScheduler.
    Rhino doesn't have properties. You have to use "setter" and "getter" methods instead.

    Example:

    Spidermonkey


    Rhino

  • Please refer to the API documentation for more details.

Migrating JavaScript from Rhino to Nashorn

Syntax Examples

Examples for syntactic differences

  • SpiderMonkey
     
Example: job name and task id
Example: add an order to a job chain
Example: set job state text
Example: read and write parameter from the current order
  • Rhino
Example: job name and task id
Example: add an order to a job chain
Example: set a job state text
Example: read and write parameter from the current order

Examples for differences when using reserved words

  • Using the Rhino engine there are no JavaScript reserved words allowed. Therefore, the following code can't be executed with the "Rhino with Beans" engine:
Example: use of a reserved word
  • Since delete is a reserved word in JavaScript the code above results in the following error:
Example: error message when using a reserved word
  • Compatible Solution:
Example: compatible solution

Getting Java Objects

The following ECMA script construction can be used to instantiate Java objects using new Packages.myPacket.myClass();

Example:Getting Java Objects

 

Note that import myPacket.myClass(); will cause an initialization error message when used in ECMA script.

For example, the following error would be typical for import sos.net.SOSMail;

Example: Getting Java Objects

For more information, see:

See also