Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 387
Alexei Martianov Avatar asked Oct 16 '19 14:10

Alexei Martianov


People also ask

What is nashorn engine is planned to be removed from a future JDK release?

Nashorn is a JavaScript engine that was removed effective with Oracle Java 15. Most likely it's being pulled in by one of your document-processing libaries. Odds are that it's Batik, pdfbox or poi. You might want to use the Maven dependencies display tool to see if you can find the connection.

What is replacing nashorn?

The Nashorn engine has been deprecated in JDK 11 as part of JEP 335 and and has been removed from JDK15 as part of JEP 372. GraalVM can step in as a replacement for JavaScript code previously executed on the Nashorn engine. GraalVM provides all the features for JavaScript previously provided by Nashorn.

Why was nashorn deprecated?

With the release of Java 11, Nashorn was deprecated citing challenges to maintenance, and has been removed from JDK 15 onwards. Nashorn development continues on GitHub as a standalone OpenJDK project and the separate release can be used in Java project from Java 11 and up.

What is the use of nashorn?

Nashorn is a JavaScript engine. It is used to execute JavaScript code dynamically at JVM (Java Virtual Machine). Java provides a command-line tool jjs which is used to execute JavaScript code. You can execute JavaScript code by using jjs command-line tool and by embedding into Java source code.


1 Answers

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"
like image 148
user7294900 Avatar answered Oct 21 '22 00:10

user7294900