JavaScript shell scripting with Nashorn

Posted by & filed under Java.

One of the nice features of Nashorn is that you can write shell scripts in JavaScript. It supports #!s, #comments, reading arguments, and everything there’s a Java library for (Including executing external processes obviously) Here’s an example #!/home/benji/nashorn7/bin/nashorn #this is a comment   print(’I am running from ‘ + __FILE__);   var name = arguments.join(’… Read more »

JavaScript tests with JUnit

Posted by & filed under Java.

This weekend I have been playing with Nashorn, the new JavaScript engine coming in Java 8. As an exercise I implemented a JUnit runner for JavaScript unit tests using Nashorn. Others have implemented similar wrappers, we even have one at work. None of the ones I have found do everything I want, and it was… Read more »