A simplified Make for Java 8 Nashorn
JavaScript Java
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
test file pattern matching May 22, 2014
.gitignore add java test Apr 10, 2014
LICENSE initial commit Apr 8, 2014
README.md Fix missing parentheses Oct 13, 2016



Nake is a simplified version of Make (Cake, Jake, Rake) for the Java 8 Nashorn Javascript Engine.

You define tasks in a project specific nakefile.js and call them from the command line. Tasks are written in Javascript and run natively on the JVM by utilizing Nashorns jjs -scripting command. This enables you to utilize everything from the JDK 8 API or any external Java libraries.


Running nake with no arguments prints all tasks in the current directory's Nakefile.

Use nake -- taskName [options] to run a specific task from your Nakefile.


Use the following steps to install Nake on POSIX systems (Mac OSX, Linux):

  • Install Java 8 and make sure $JAVA_HOME points to your Java home directory
  • Link jjs to /usr/bin so you can use it from any directory:
$ cd /usr/bin
$ ln -s $JAVA_HOME/bin/jjs jjs
  • Clone the nake repository or copy src/nake.js to your machine
  • Make nake.js executable: chmod +x /path/to/nake/src/nake.js
  • Link src/nake.js to usr/bin so you can use it from any directory:
$ cd /usr/bin
$ ln -s /path/to/nake/src/nake.js nake

Nake also runs on Windows: Set PATH to nake.js directory; then run Nake with jjs -scripting nake.js -- taskName.

Getting started

Create a file called nakefile.js in your projects root directory with the following content:

task('hello', 'Hello World', function() {
  print('Hello World!');

Open the terminal, cd into any project directory and type nake -- hello.

Next, check out the API Documentation and example tasks. You should also consider reading my Nashorn Tutorial to get started with the Nashorn engine.


The java example found in test/java contains a sample java application with some basic java-related nake tasks:

Run the java application:

Invokes the java main method. Nake arguments will be passed to java.

task("run", "Run java application", function(options) {
    .exec("java com/winterbe/nake/java/Main ${options[0]}")

Run the task from your terminal:

nake -- run [arg]

Compile all java files:

Compiles all java files from src to out.

task("compile", "Compile all java files", function() {
    .exec("find src -name *.java")
    .apply(function(result) {
      return java.lang.String.join(" ", result.split("\n"));
    .print("compiling java files...")
    .exec("mkdir -p out")
    .exec("javac -d out {{files}}")

Run the task from your terminal:

nake -- compile

Keep in mind that you can run nake tasks from any subfolder of your project. Read the API Documentation for a detailed description.


Your Feedback is highly appreciated. Feel free to file an issue or ping me on Twitter or Google+.