I have a quarkus App (jdk11), which makes a call out to Javascript, using Graal.js . My pom.xml contains dependencies on graal.js:
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.graalvm.js</groupId>
<artifactId>js-scriptengine</artifactId>
<version>22.3.1</version>
</dependency>
When I run using a normal JVM It works fine, however I do get the warnings:
[engine] WARNING: The polyglot context is using an implementation that does not support runtime compilation.
The guest application code will therefore be executed in interpreted mode only.
Execution only in interpreted mode will strongly impact the guest application performance.
For more information on using GraalVM see https://www.graalvm.org/java/quickstart/.
However, when I switch to running my app using Graalvm (graalvm-ce-java11-22.3.1), it doesn't work at all -
new ScriptEngineManager().getEngineByName("graal.js");
Returns null. It will return Nashorn, if I ask it to. But, I need graal.js.
What do I need to do, to make graal.js available, when using GraalVM
The reason it doesn't work, is because (rather than including the JS engine as maven dependencies), you have to install JS into graal_vm
As follows. cd to the Graal distribution, bin directory. Then:
./gu install js
Once installed. it works fine.