Geertjan's Blog

  • April 24, 2015

Nashorn from the Perspective of the Java EE Developer

Geertjan Wielenga
Product Manager

What is it that's interesting about Nashorn, which is now built into Java 8, for a Java EE developer?

Adam Bien's response:

First, Nashorn is just JavaScript in Java 8. A very fast one and very well integrated with Java. For a Java EE developer, the first interesting thing is automation. For instance, yesterday I had to find some problems in my log files, so I built a quick parser with Nashorn and Java 8, and it was a very pragmatic solution, it took me 20 minutes, and it was ready to go. Then, you know, deployment, starting servers. You can use Nashorn as a system scripting language, which is very very convenient. This is the most obvious and, I would say, least intrusive usage of Nashorn. Then, of course, you can embed Nashorn into your application. What you gain from that—flexible checks, validation rules, algorithms. It is easier to use Nashorn than to write your own parsers, for instance. And what you can also do, of course, is use Nashorn to start Java. One example would be—I created an integration solution where you can very easily map, via JavaScript, input to output, and be able to read a database and output it to Excel, without recompiling the solution, for instance. Wherever you need flexibility and you don't want to redeploy the application, Nashorn might be the right answer.

From a recent interview by Coman Hamilton (from JAX) with Adam Bien, here on YouTube

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.