I am developing a Java application that needs to execute JavaScript. Nashorn JS engine is about to get deprecated and the replacement is the set of APIs provided by Graal SDK wh
Using both IntelliJ (2020.2) and GraalVM (graalvm-ce-java11-20.3.0) I was able make the following code work:
public static void main(String[] a0rgs) {
System.out.println("Hello World!");
Context context = Context.create();
context.eval("js", "console.log('hello from javascript');");
}
Just by adding this dependency to maven
:
org.graalvm.sdk
graal-sdk
20.3.0