If I start up the Nashorn CLI via jjs
, I can't cleanly exit it without using ctrlc.
I tried:
exit
quit
System.exit()
But none worked.
Simply typing "exit" or "quit" won't work! That will just print toString on those functions (something like "function() { [native code] }"). You need to call those functions like "exit()" or "exit(2)". Also, you need to invoke java.lang.System.exit(int) with fully qualified package name "java.lang" (unlike java where java.lang is always imported!)
As per the documentation:
Enter either
exit()
orquit()
to exit the Nashorn shell.