Reputation: 425043
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.
Upvotes: 1
Views: 1274
Reputation: 4405
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!)
Upvotes: 1
Reputation: 425043
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.
Upvotes: 3