javanashornjjs

How to exit Nashorn jjs command line tool?


If I start up the Nashorn CLI via jjs, I can't cleanly exit it without using ctrlc.

I tried:

But none worked.


Solution

  • As per the documentation:

    quit()
    exit()

    These functions are synonymous, causing the current script process to exit to the system.

    You can pass an integer value as the argument that represents the exit code to be returned to the system. By default, without an argument, the exit code is set to 0, meaning that the process terminated correctly.

    Enter either exit() or quit() to exit the Nashorn shell.