Avatar.js and Project Avatar

jbandi picture jbandi · Mar 10, 2014 · Viewed 7.3k times · Source

In the context of Java 8 and Nashorn I see two projects being regularly mentioned.

Avatar.js and Project Avatar

What is the relation of these projects?

Avatar.js has very little documentation. As far as I gathered it offers the possibility to execute node applications on the JVM.

Project Avatar seems to build on Avatar.js. However the scope seems to be to provide an alternative Web-Framework for Java EE 7. Is it also possible to execute node programs (like i.e. grunt) with Project Avatar?

Answer

Johann picture Johann · Mar 10, 2014

Update: Project Avatar was officially halted 2015-02-12.

Avatar.js is the open-source version of what was informally called 'node.jar' (See this post from the avatar-js mailing list). In other words, it is a NodeJS-compatible API, running on Nashorn. Project Avatar appears to be Oracle's answer to the NodeJS API, offering an alternative platform which also provides compatibility with the NodeJS API and ecosystem via Avatar.js.

Therefore it is not that Project Avatar is built on Avatar.js, but rather that "Avatar.js is one component of Project Avatar. Nashorn is the JavaScript engine used to run both." (again, from this post).

The Avatar.js homepage currently has a list of modules known to run, including "grunt". It would appear that Project Avatar currently includes a build of Avatar.js as "avatar-js.jar", as found in the current latest commit, though it is 4 months old. So I think the answer is that yes, the current build of Project Avatar will allow you to run Node-compatible modules.

As you've pointed out, both of these initiatives lack documentation, and are in their infancy. Time and community engagement will show where they fit best.