...
- Oracle Nashorn: A Next-Generation JavaScript Engine for the JVM.
- We recommend JobScheduler users running JavaScript scripts to use this article to update their scripts.
- One of the most important changes is likely to be that Nashorn does not support the
importClass
statement. Instead of theimportClass
statement you can use the classJavaImporter
Differences in Practice
Example for class import
...
Code Block | ||||
---|---|---|---|---|
| ||||
<script language="javax.script:javascriptJavaScript"> <![CDATA[ var imports = new JavaImporter( java.io.File, java.nio.charset.Charset ); function spooler_process() { with (imports) { // usage of File // usage of Charset } // also possible: // usage of java.lang.Thread return true; } ]]> </script> |
...
- To make the changeover as smooth as possible, we recommend that users specify that the default JavaScript engine for the Java version is used, i.e. "
javax.script:ECMAscriptJavaScript
" instead of "javax.script:rhino"
. - This will ensure that the changeover of the JavaScript engine will occur at the same time as the changeover to Java 1.8.
- Please note that at the time of writing it is not yet decided when JobScheduler will become Java 1.8 capable but this is likely to occur towards the end of 2014. Oracle have announced that they will stop updating Java 7 after April 2015.
...