You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

The JobScheduler supports different javascript engines: spidermonkey and "Rhino with Beans"

  • The spidermonkey engine is only available on 32 bit. It is selected by <script languagh1. "javascript"> or <script language"spidermonkey">
  • The "Rhino with Beans" engine is available on 32 bit and 64 bit. It is selected by <script languagh1. "java:javascript">, <script language"java:rhino"> or <script language="java:ecmascript">
  • Using the "Rhino with Beans" engine there are no javascript reserved words allowed.

The following code can't be executed with the "Rhino with Beans" engine:

 var file = new java.io.File(files[i]);
 file.delete();

Since delete is a reserved word in javascript the code above results in the following error:

 javax.script.ScriptException: sun.org.mozilla.javascript.internal.EvaluatorException: missing name after . operator (<Unknown source>#26) in <Unknown   source> at line number 26
       at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
       at com.sun.script.javascript.RhinoScriptEngine.eval(Unknown Source)
       at javax.script.AbstractScriptEngine.eval(Unknown Source)
       at com.sos.scheduler.scripting.Module.call(Module.java:76)
       at com.sos.scheduler.scripting.Module.callBoolean(Module.java:85)

Solution:

 var file = Packages.java.io.File(files[i]);
 file["delete"]();				// because delete is reserved in javascript
  • No labels