Nashorn is a JavaScript engine developed in the Java programming language by Oracle and released in Java 8.
Nashorn
- Implements a light weight high-performance JavaScript runtime in Java with a native JVM
- Developers can develop free standing JavaScript applications using the jrunscript command- line tool
- It's all together new code base, foucsed on the newer technologies.
- Utilizes the MethodHandles and InvokeDynamic API's described in JSR-292
Examples:
------------
Inline scripts:
---------------
jrunscript -e "print ('Hello Programmers Stack Viewers')" ;
Hello Programmers Stack Viewers
Interactive mode:
-----------------
jrunscript
nashorn>print ('Welcome to Programmers stack');
Welcome to Programmers stack
nashorn> 50+40
90
nashorn> localThread = new java.lang.Thread(function() {print ('Programmers Thread');})
Thread[Thread-0,main]
nashorn>localThread.start()
nashorn>Programmers Thread
No comments:
Post a Comment