Class NashornScriptEngineFactory

java.lang.Object
jdk.nashorn.api.scripting.NashornScriptEngineFactory
All Implemented Interfaces:
ScriptEngineFactory

@Deprecated(since="11",
            forRemoval=true)
public final class NashornScriptEngineFactory
extends Object
implements ScriptEngineFactory
Deprecated, for removal: This API element is subject to removal in a future version.
Nashorn JavaScript script engine and APIs, and the jjs tool are deprecated with the intent to remove them in a future release.
JSR-223 compliant script engine factory for Nashorn. The engine answers for:
  • names "nashorn", "Nashorn", "js", "JS", "JavaScript", "javascript", "ECMAScript", and "ecmascript";
  • MIME types "application/javascript", "application/ecmascript", "text/javascript", and "text/ecmascript";
  • as well as for the extension "js".
Programs executing in engines created using getScriptEngine(String[]) will have the passed arguments accessible as a global variable named "arguments".
Since:
1.8u40
  • Constructor Details

    • NashornScriptEngineFactory

      public NashornScriptEngineFactory()
      Deprecated, for removal: This API element is subject to removal in a future version.
  • Method Details

    • getScriptEngine

      public ScriptEngine getScriptEngine​(ClassLoader appLoader)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new Script engine initialized with the given class loader.
      Parameters:
      appLoader - class loader to be used as script "app" class loader.
      Returns:
      newly created script engine.
      Throws:
      SecurityException - if the security manager's checkPermission denies RuntimePermission("nashorn.setConfig")
    • getScriptEngine

      public ScriptEngine getScriptEngine​(ClassFilter classFilter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new Script engine initialized with the given class filter.
      Parameters:
      classFilter - class filter to use.
      Returns:
      newly created script engine.
      Throws:
      NullPointerException - if classFilter is null
      SecurityException - if the security manager's checkPermission denies RuntimePermission("nashorn.setConfig")
    • getScriptEngine

      public ScriptEngine getScriptEngine​(String... args)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new Script engine initialized with the given arguments.
      Parameters:
      args - arguments array passed to script engine.
      Returns:
      newly created script engine.
      Throws:
      NullPointerException - if args is null
      SecurityException - if the security manager's checkPermission denies RuntimePermission("nashorn.setConfig")
    • getScriptEngine

      public ScriptEngine getScriptEngine​(String[] args, ClassLoader appLoader)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new Script engine initialized with the given arguments and the given class loader.
      Parameters:
      args - arguments array passed to script engine.
      appLoader - class loader to be used as script "app" class loader.
      Returns:
      newly created script engine.
      Throws:
      NullPointerException - if args is null
      SecurityException - if the security manager's checkPermission denies RuntimePermission("nashorn.setConfig")
    • getScriptEngine

      public ScriptEngine getScriptEngine​(String[] args, ClassLoader appLoader, ClassFilter classFilter)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Create a new Script engine initialized with the given arguments, class loader and class filter.
      Parameters:
      args - arguments array passed to script engine.
      appLoader - class loader to be used as script "app" class loader.
      classFilter - class filter to use.
      Returns:
      newly created script engine.
      Throws:
      NullPointerException - if args or classFilter is null
      SecurityException - if the security manager's checkPermission denies RuntimePermission("nashorn.setConfig")