Recently we migrated from JDK 8 to JDK 16 and found that JavaScript engine is removed from Java. We tried including GraalVM jars into classpath but it did not work. The following code was returning null.
ScriptEngineManager factory = new ScriptEngineManager();
ScriptEngine engine = factory.getEngineByName( "JavaScript" );
After struggling for a long time I figured out that following list of jars works.
graal-sdk-21.2.0.jar
icu4j-69.1.jar
js-21.2.0.jar
js-launcher-21.2.0.jar
js-scriptengine-21.2.0.jar
regex-21.2.0.jar
truffle-api-21.2.0.jar
truffle-nfi-21.2.0.jar
Please comment if you have any question.
No comments:
Post a Comment