Java Reference
In-Depth Information
Table 9-1.
The List of Options for the jrunscript Shell
Option
Description
-classpath <path>
Used to specify the CLASSPATH.
-cp <path>
The same as the
-classpath
option.
-D<name>=<value>
Sets a system property for Java runtime.
-J<flag>
Passes the specified
<flag>
to the JVM on which
jrunscript
is run.
-l <language>
Allows you to specify a scripting language that you want
to use with the
jrunscript
. By default, Rhino JavaScript is
used in JDK 6 and JDK 7. In JDK 8, Nashorn is the default.
If you want to use a language other than JavaScript, say
JKScript
, you will need to use
-cp
or
-classpath
option to
include the JAR file that contains the script engine.
-e <script>
Executes the specified script. Typically, it is used to execute
a one-liner script.
-encoding <encoding>
Specifies the character encoding used while reading
script files.
-f <script-file>
Evaluates the specified
script-file
in batch mode.
-f -
Allows you to evaluate scripts in interactive mode. It reads
scripts from the standard input and executes it.
-help
Outputs the help message and exits.
-?
Outputs the help message and exits.
-q
Lists all available script engines and exits. Note that script
engines other than JavaScript are available only when you
include their JAR files using the
-cp
or
-classpath
option.
The
[arguments]
part of the command is a list of arguments, which are interpreted
depending on whether the
-e
or
-f
option is used or not. Arguments that are passed
to the script are available inside the script as an object named
arguments
. Please refer
to Chapter 4 for more details on using the
arguments
object in scripts. Table
9-2
lists
interpretations of the arguments when they are used with the
-e
or
-f
option.
Search WWH ::
Custom Search