The JavaScript Nashorn language has been removed from the modeling tool. You can learn more about deprecated JavaScript Nashorn here. Please use JavaScript Rhino instead. For more information, see the JavaScript migration from Nashorn to Rhino engine page.
All JavaScript Nashorn usages need to be changed to JavaScript Rhino in projects to work correctly. Below are the recommended steps for achieving that:
- Use one of the following options to run the modeling tool:
- Option 1. Run modeling tool without executing JavaScript Nashorn scripts (default)
Proceeding with this option means that none of your project's JavaScript Nashorn scripts will work until they are changed to or rewritten in JavaScript Rhino. - Option 2. Run modeling tool executing JavaScript Nashorn scripts with JavaScript Rhino engine
Proceeding with this option means that your project's JavaScript Nashorn scripts will be executed using the JavaScript Rhino engine; thus, the majority of the scripts will work, but they will still need to be changed to or rewritten in JavaScript Rhino.
- Option 1. Run modeling tool without executing JavaScript Nashorn scripts (default)
- Open a project containing JavaScript Nashorn usages
- Find and resolve JavaScript Nashorn usages
Diagram showing the JavaScript Nashorn usages' change to JavaScript Rhino.
Running the modeling tool
Option 1. Run modeling tool without executing JavaScript Nashorn scripts (default)
Following this option means:
- The JavaScript Nashorn scripts found in the project are not executed, meaning that the model will not function as expected due to script failures.
- This is the default option; simply run the modeling tool and open a project containing JavaScript Nashorn usages.
For example, if you open a table containing a custom column that has an expression with a JavaScript Nashorn script, an 'Expression evaluation failure' error notification is displayed.
Option 2. Run modeling tool executing JavaScript Nashorn scripts with JavaScript Rhino engine
Following this option means:
- The JavaScript Nashorn scripts found in the project are executed using the JavaScript Rhino engine. Due to the similarities between Rhino and Nashorn, most of the project's scripts are likely to work.
- To proceed with this option, you need to add an additional system property, as described below.
To enable JavaScript Nashorn script execution with JavaScript Rhino engine
- Open the <modeling tool installation directory>\bin\<modeling tool name>.properties file.
- Locate the JAVA_ARGS= line
- Add the following system property:
-Dexecute.legacy.javascript.as.rhino=true - Restart the modeling tool.
For example, if you open a table containing a custom column that has an expression with a JavaScript Nashorn script, the 'JavaScript Nashorn (deprecated)' error notification is displayed.
Opening a project containing JavaScript Nashorn usages
Opening a project that contains JavaScript Nashorn scripts immediately displays a notification about the removal of the JavaScript Nashorn scripting language. The notification is displayed only once upon the first opening of the project with the new version of the tool. You can click the Find Usages link to run the Deprecated JavaScript validation suite to locate all usages of JavaScript Nashorn (for more information, see the Finding and resolving JavaScript Nashorn usages section below).
Finding and resolving JavaScript Nashorn usages
The recommended steps to find and resolve JavaScript Nashorn usages:
- Run the Deprecated JavaScript validation suite to find all JavaScript Nashorn usages.
Evaluate each script failing the validation and rewrite it in JavaScript Rhino if necessary.
Due to the similarities between JavaScript Rhino and JavaScript Nashorn, most of the project's Nashorn scripts are likely to work with the Rhino engine. However, a review is recommended as to whether the Nashorn scripts' execution with the Rhino engine are accurate. If not, the Nashorn script must be modified to work in Rhino.
- Resolve the validation error via the Change to JavaScript Rhino solver.
Finding JavaScript Nashorn usages
To locate all usages of JavaScript Nashorn in a project, we recommend running the Deprecated JavaScript validation suite (Analyze > Validation > Validate). The validation suite contains the Deprecated JavaScript validation rule, which:
- detects all JavaScript Nashorn usages;
- allows you to change the JavaScript Nashorn language to JavaScript Rhino for implemented expressions via the Change to JavaScript Rhino solver.
After running the Deprecated JavaScript validation suite, hold Ctrl+A to select all detected instances of JavaScript Nashorn and resolve them via the Change to JavaScript Rhino solver in the Validation Results panel.
For a detailed description of the validation rule, see the Deprecated JavaScript page.
Resolving JavaScript Nashorn usages
The Change to JavaScript Rhino solver changes the used scripting language without affecting the script itself. In many cases, changing the used scripting language will not affect the functionality of the script. Otherwise, the 'Expression evaluation failure' error notification (shown below) will appear, requiring you to rewrite the script in JavaScript Rhino.