JMeter 警告:计划从未来的 JDK 版本中删除 Nashorn 引擎

JMeter Warning: Nashorn engine is planned to be removed from a future JDK release

当我运行最近下载JMeter 5.1.1时,我在terminal window中看到很多次:

Warning: Nashorn engine is planned to be removed from a future JDK release

我使用网络搜索找到了 JEP 335: Deprecate the Nashorn JavaScript Engine

Motivation

The Nashorn JavaScript engine was first incorporated into JDK 8 via JEP 174 as a replacement for the Rhino scripting engine. When it was released, it was a complete implementation of the ECMAScript-262 5.1 standard.

With the rapid pace at which ECMAScript language constructs, along with APIs, are adapted and modified, we have found Nashorn challenging to maintain.

我希望看到新引擎现在得到更多使用,但没有,我找不到 运行 JavaScript 的替代品。 JavaScriptJMeter 中会发生什么?它不会 运行 我们使用 鼓励 使用 Groovy?

顺便说一句,如何从终端中删除该警告?

Groovy 在 JMeter 的最佳实践中是 encouraged

We advise using Apache Groovy

在新版本 changes 中有针对此警告的解决方法:

To silence these warnings, add -Dnashorn.args=--no-deprecation-warning to your Java arguments. That can be achieved by setting the enviroment variable JVM_ARGS

export JVM_ARGS="-Dnashorn.args=--no-deprecation-warning"

您也可以安装 Rhino,请参阅 https://jmeter.apache.org/changes.html#Known%20problems%20and%20workarounds

上的注释