Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Refer to --no-deprecation-warning as removed as per discussion on JSCRIPTING-19


This is a collection point for any “generic” scripting tips or examples that don’t pertain to specific use cases but just illustrate harder or non-obvious ways to use Javascript in the Java environment.

Setting ‘nashorn.args’

In JDK11 you set arguments to the The Nashorn scripting engine can be configured via the nashorn.args system property - and on JDK11, an argument could have been passed to silence the Nashorn deprecation warning:

Code Block

It appears that this mechanism has changed in new versions and you need an extra level of indirection


The --no-deprecation-warning argument is no longer accepted in nashorn.args and causes Nashorn to fail to load (silently, see below).

Debugging issues with the Nashorn Scripting Engine

The engine can fail (and indeed fail to load) silently. To debug this (not your script itself) you can set the nashorn.debug system property to “true” (-Dnashorn.debug=true).

Accessing Classes or Static Methods