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

4

21

When I run JMeter 5.1.1 recently downloaded, I see many times in terminal window:

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

I've used web search and found 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.

I expected to read that new engine is now in more use, but no, I could not find what will run JavaScript in replacement. What would happen with JavaScript in JMeter? It will not run and we use encouraged to use Groovy?

BTW, how to remove that warning from terminal?

Thrombocyte answered 16/10, 2019 at 14:46 Comment(0)
P
33

Groovy is encouraged in JMeter's best practices

We advise using Apache Groovy

In new version changes there's a workaround for this warning:

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"
Puffery answered 16/10, 2019 at 15:19 Comment(0)
B
1

Even better, you can use:

static {
  System.setProperty("nashorn.args","--no-deprecation-warning");
}

Do this before you instantiate the ScriptEngineManager Object and you'll be set! No warnings and it's in your code instead of just your launch environment!

Bonhomie answered 10/12, 2023 at 4:27 Comment(0)
C
0

You may also install Rhino, see note on https://jmeter.apache.org/changes.html#Known%20problems%20and%20workarounds

Cockoftherock answered 28/2, 2022 at 10:48 Comment(0)
L
0

It indicates that the Java Development Kit (JDK)'s Nashorn JavaScript engine is scheduled to be removed in a later JDK version. The notice indicates that Nashorn will no longer be supported in future JDK versions, thus you should begin moving your code to use an alternate JavaScript engine, like GraalVM or another appropriate choice. This is part of Oracle's effort to streamline and improve the JDK by removing deprecated or less-used components.

Lance answered 4/1 at 6:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.