Using Nashorn in Java?

I am reading about new features in Java 8 and found out that it has to do with Nashorn (Javascript engine). Can someone explain to me why I / should use Javascript engine inside Java. What programming problems will it solve? any examples

Thanks Ravi

+3


source to share


1 answer


Simply, it will allow you to create standalone JavaScript programs and allow JavaScript to be embedded in Java. Java must be compiled into a so-called "machine language" before it can be run. JavaScript is text based and interpreted and interpreted by browsers. So being able to use this technology inside Java is pretty cool. JRuby is another example of a scripting language that can run inside Java, as well as Jython, which is the Python equivalent. They are all just wrappers for using languages ​​within Java. It is already possible to run dynamic languages ​​on top of the JVM, but the goal is to facilitate new dynamic language features and improve their performance.

One advantage I can think of is using JavaScript to script a Java game.



Hope this helps :)

+2


source







All Articles