From ca08301cf26b5bd2cf047cf59572ca901c5f78ba Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 10 Aug 2020 18:12:53 +0200 Subject: [PATCH] add some documentation about GraalVM JavaScript --- manual/Tasks/script.html | 16 +++++++++++++++- manual/install.html | 17 ++++++++++++++++- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/manual/Tasks/script.html b/manual/Tasks/script.html index 7cb6a477c..e029cd9db 100644 --- a/manual/Tasks/script.html +++ b/manual/Tasks/script.html @@ -274,11 +274,25 @@ with importClass/importPackage. For other packages you full classified name with Packages. For example Ant's FileUtils class can be imported with importClass(Packages.org.apache.tools.ant.util.FileUtils)

-

In Java 8+, you may use the built-in Nashorn JavaScript engine rather than Rhino (which is +

In Java 8 up until Java 14, you may use the built-in Nashorn JavaScript engine rather than Rhino (which is available in Java 7 runtime). Then, use Java.type as import statement for any Java class or the compatibility script: load("nashorn:mozilla_compat.js");.

+ +

Starting with Java 15 Nashorn has been removed again and you need + to provide an external JavaScript engine. Your best option probably + is GraalVM + JavaScript which requires you to add a lot of extra jars. For + GraalVM JavaScript 20.1 you'll + need org.graalvm.js:js, org.graalvm.js:js-engine + which in turn + require org.graalvm.regex:regex, org.graalvm.truffle:truffle-api, org.graalvm.sdk:graal-sdk, + and com.ibm.icu:icu4j. GraalVM JavaScript is not a + drop-in replacement for Nashorn, see + Graal's Nashorn + Migration Guide for more details.

+

The <script> task populates the Project instance under the name project, so we can use that reference. Another way is to use its given name or getting its reference from the task itself. The Project provides methods for accessing diff --git a/manual/install.html b/manual/install.html index 4938e632b..3984bee36 100644 --- a/manual/install.html +++ b/manual/install.html @@ -828,11 +828,26 @@ these tasks available. Please refer to the Installing A target="_top">https://www.ibm.com/software/awdtools/netrexx/library.html - rhino.jar
(included in Java 7 runtime, replaced by Nashorn in Java 8 and later) + rhino.jar
(included in Java 7 runtime, replaced by Nashorn + in Java 8 and later, dropped with Java 15) JavaScript with script task
Note: Apache BSF 2.4.0 works only with Rhino 1.5R4 and later versions. https://www.mozilla.org/rhino/ + + graalvm js.jar and js-scriptengine.jar
+ JavaScript with script task for Java 15 and later
+ + Java 15 has dropped Nashorn + and GraalVM JavaScript + is meant to replace it - outside of the Java class + library.
+ Note GraalVM JavaScript is not a drop-in + replacement for Nashorn, see the script task documentation for + details. Also GraakVM JavaScript requires a couple of more + dependencies, in particular GraalVM regex, truffle, the GraalVM + SDK and ICU. + jython.jar Python with script task