Using Nashorn instead of Rhino in a project.

A. Sundararajan sundararajan.athijegannathan at oracle.com
Sat Feb 23 06:31:07 PST 2013


When you say API,  do you mean Java API to access script engine? If you 
use javax.script API to access Rhino engine, you could use the same API 
to access nashorn as well. If you had used Rhino's own API, then you'll 
have to port - I'd suggest using javax.script API.

In terms of language, nashorn is compliant with ECMAScript 262 Edition 
5.2 specification (pass all test262 tests). Rhino has a number of 
language additions + standard object additions (like __proto__ 
non-standard property for objects).  Nashorn does not support all of it 
- but most often used are supported.

Also, there is a mozilla_compat.js script which can be loaded

     load("nashorn:mozilla_compat.js");

This will support for __proto__, __defineGetter__ etc. (few of the less 
often used features). You may want to check out 
nashorn/doc/JavaScriptingProgrammersGuide.html for details.

-Sundar


On Saturday 23 February 2013 07:54 PM, AMILA RANATUNGA wrote:
> Hi,
>
> We have a project which has been implemented using Rhino. Will it be
> compatible with Nashorn?. Are those API's are equivalent?
>
> Thnaks ..!!



More information about the nashorn-dev mailing list