02-25-2021 10:31 PM
Hello,
I'm developing application with Activiti 6 embedded as library, compiled together with my application. I have javascript incorporated in the process as ScriptExecutionListener. Everything works fine under OpenJDK 8.
Now I need to upgrade to Java 11, specifically using the upstream OpenJDK 11. As Nashorn in already removed in Java 11, how could we use javascript in Activiti? I noticed that Nashorn is still included in Oracle JDK 11. But I have to use the upstream OpenJDK 11 due to licensing.
I'm considering to bring Rhino inside my application. Is there any reference to do this?
Thank you.
02-26-2021 08:46 AM
I have found way to get it works on OpenJDK 11 (and possibly on other JDK).
First, get the rhino-jdk8.zip from https://github.com/zeroboo/java-scripting-rhino-jdk8/releases/tag/v1.0.0 . It contains js.jar and js-engine.jar. Ignore the js.jar as it is readily available in maven central.
Install the js-engine.jar into local maven repository (.m2 folder). Give some sensible name for it, e.g org.mozilla:rhino-js-engine:1.0
Then add the following maven dependencies to our application ;
<!-- this coming from maven central --> <dependency> <groupId>org.mozilla</groupId> <artifactId>rhino</artifactId> <version>1.7.13</version> </dependency> <!-- this coming from local repository --> <dependency> <groupId>org.mozilla</groupId> <artifactId>rhino-js-engine</artifactId> <version>1.0</version> </dependency>
Build and run as usual, now all javascript runs under Rhino.
02-26-2021 08:46 AM
I have found way to get it works on OpenJDK 11 (and possibly on other JDK).
First, get the rhino-jdk8.zip from https://github.com/zeroboo/java-scripting-rhino-jdk8/releases/tag/v1.0.0 . It contains js.jar and js-engine.jar. Ignore the js.jar as it is readily available in maven central.
Install the js-engine.jar into local maven repository (.m2 folder). Give some sensible name for it, e.g org.mozilla:rhino-js-engine:1.0
Then add the following maven dependencies to our application ;
<!-- this coming from maven central --> <dependency> <groupId>org.mozilla</groupId> <artifactId>rhino</artifactId> <version>1.7.13</version> </dependency> <!-- this coming from local repository --> <dependency> <groupId>org.mozilla</groupId> <artifactId>rhino-js-engine</artifactId> <version>1.0</version> </dependency>
Build and run as usual, now all javascript runs under Rhino.
03-01-2021 06:48 AM
Hi @jmerari
Great that you found a solution & thanks for updating us on how you did it - really helpful to others.
Cheers,
Explore our Alfresco products with the links below. Use labels to filter content by product module.