Node.js arrives for the JVM

Nodyn project sponsored by Red Hat ports Node.js APIs to JVM, for closer integration between Node.js and existing Java apps

"JavaScript everywhere, and everything ported to JavaScript" -- it's either a running joke in IT these days or a stone-cold truth. Evidence is tending toward the latter, what with Node.js becoming a jack-of-all-trades framework for many workloads and environments.

With Nodyn, Node.js gains yet another place it can run: the Java Virtual Machine.

Nodyn, a project sponsored by Red Hat via its Project:Odd team, works by leveraging two other projects: the DynJS project, which provides the actual JavaScript runtime (ECMAScript, actually) for the JVM, and the Vert.x application platform/event bus system.

But the main motive for allowing Node.js apps run on the JVM isn't the mere novelty of doing so; it's about allowing Node.js apps to work directly with existing Java apps. Consequently, the Nodyn project is also part of the JBoss ecosystem for the sake of further integration with the rest of the Java application world, as well as apps from any other language currently running on the JVM (such as, Clojure).

Because of the way Nodyn is implemented, it isn't a direct port of the Node.js code. Instead, it replicates the functionality of Node.js's APIs. Not everything works yet -- the wiki page devoted to tracking Nodyn compatibility with Node.js shows how things like the VM API (itself unstable in Node.js) and TLS/SSL haven't been implemented yet. Anyone expecting drop-in compatibility for Node.js apps at this stage is going to be let down; for now the project is best approached as a future direction for Node.js and Java to move closer together, not as an actual production solution.

Nodyn is far from the only way to have Node.js talk to other platforms. One solution native to Node itself is node-ffi -- short for "Foreign Function Interface" -- which allows Node.js to create bindings with dynamic libraries without needing any C++ code on the part of the Node.js programmer. It isn't clear yet how node-ffi's performance will stack up against Nodyn in the long run, although Nodyn seems like it's aiming to be the far more complete, robust solution of the two, thanks to such features as the clustering capabilities inherent in Vert.x.

This story, "Node.js arrives for the JVM," was originally published at Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow on Twitter.

Copyright © 2014 IDG Communications, Inc.

How to choose a low-code development platform