Would you like to write programs on your Raspberry Pi using the popular JavaScript language?
Well you can. Oracle's latest Java 8 release has a built-in JavaScript engine, known as Nashorn.
Here are a few of Nashorn's capabilities:• run standalone JavaScript programs (no web server required)
• run JavaScript interactively from the command line
• access the complete Java library
• interoperate with existing Java code and APIs
• enjoy high runtime performance from the Rhino-based technology
That's a powerful feature set. For example, you could hack a Minecraft Pi Edition game in JavaScript by calling the functions defined in Mojang's Java API.
Oracle's technetwork site has an informative how to use Nashorn article. There's loads of code examples plus details of using the jjs command line tool, embedding JavaScript commands in Java programs and how to interact with JSON.
Benjamin Winterberg's blog post is another useful source in information.
The official Nashorn scripting reference documention is hosted on the Oracle docs website.
No comments:
Post a Comment