jrunscript-command line script shell

In this article we are going to elaborate the jrunscript command tool which is a part of JAVA commands (comes with jdk package). This article is the continuation of this previous article.

As we know the standard format of commands in java, the jrunscript command also have the format(in command prompt)
jrunscript [options] [arguments] 

jrunscript is a command line script shell, supports both an interactive (read-eval-print) mode[input code and response] and a batch (-f option) mode[all input together] of script execution. This is scripting language independent shell, but by default JavaScript is used. To set other languages, we have to use options.

jrunscript Options : 

-classpath or cp [path] : Specify where to find the user's .class files that are accessed by the script.
-D[name]=[value] : Sets a Java system property.
-J[option] : Pass option directly to the JVM on which jrunscript is running.
-l [language]: Use the specified scripting language.
-e [script] : Evaluate the given script.
-encoding [encoding] : Specify the character encoding used while reading script files.
-f [script-file] : Evaluate the given script file (batch mode).
-f - : Read and evaluate a script from standard input (interactive mode).
-q : List all script engines available and exit.

Most of the options are used in the batch script running mode. In interactive mode, it works just like as command shell.  We can also run a JavaScript file directly

jrunscript [fileName] [arguments] 
Example : jrunscript test.js arg1 arg2 arg3

Thanks...:)

No comments:

Post a Comment