# Nashorn

## Links

Main blog https://blogs.oracle.com/nashorn/ by Jim Laskey

Sources: http://hg.openjdk.java.net/nashorn/jdk8/nashorn

- http://insin-notes.readthedocs.org/en/latest/JavaOne2012/nashorn_node_jpa_persistence_bof.html references Node.jar project (implementation of Node.js on JVM). However there are no more news, and the projects is closed-sourced in Oracle.

  - Node.jar, Akhil Arora
  - JPA & Node.jar, Doug Clarke

- Java Platform, Standard Edition Nashorn User's Guide

- Java Scripting Programmer's Guide

Old and excited blog post: http://kaeff.net/posts/why-ruby-and-nodejs-folks-should-care-about-project-nashorn.html

If you use JavaFX inside JavaScript, you should use SDK, not just JRE.

## Java 8 script utils

Java 8 goes with 2 utils: `jjs` for running JavaScript on Nashorn engine and `jrunscript` for running any script engine

### `jjs` command line util

    C:\Program Files\Java\jdk1.8.0\bin>jjs.exe -v

    nashorn 1.8.0

    C:\Program Files\Java\jdk1.8.0\bin>jjs.exe -h

    jjs []  [-- ]
            -D (-Dname=value. Set a system property. This option can be repeated.)

            -cp, -classpath (-cp path. Specify where to find user class files.)

            -doe, -dump-on-error (Dump a stack trace on errors.)
                    param: [true|false]   default: false

            -fv, -fullversion (Print full version info of Nashorn.)
                    param: [true|false]   default: false

            -fx (Launch script as an fx application.)
                    param: [true|false]   default: false

            -h, -help (Print help for command line flags.)
                    param: [true|false]   default: false

            -scripting (Enable scripting features.)
                    param: [true|false]   default: false

            -strict (Run scripts in strict mode.)
                    param: [true|false]   default: false

            -t, -timezone (Set timezone for script execution.)
                    param:    default: Asia/Shanghai

            -v, -version (Print version info of Nashorn.)
                    param: [true|false]   default: false

### `jrunscript` command line util

    C:\Program Files\Java\jdk1.8.0\bin>jrunscript.exe  -h
    Usage: jrunscript [options] [arguments...]

    where [options] include:
      -classpath     Specify where to find user class files
      -cp            Specify where to find user class files
      -D=     Set a system property
      -J             Pass  directly to the runtime system
      -l         Use specified scripting language
      -e