from small one page howto to huge articles all in one place
Last additions:
May 25th. 2007:
April, 26th. 2006:
|
You are here: manpages
JRUNSCRIPT
Section: JDK Commands (1) Updated: 2023 Index
Return to Main Contents
NAME
jrunscript- run a comman-line script shell that supports interactive
and batch modes
SYNOPSIS
B]Note:R]
This tool is B]experimentalR] and unsupported.
V]jrunscriptR] [I]optionsR]] [I]argumentsR]]
- I]optionsR]
-
This represents the V]jrunscriptR] comman-line options that can
be used.
See B]Options for the jrunscript CommandR].
- I]argumentsR]
-
Arguments, when used, follow immediately after options or the command
name.
See B]ArgumentsR].
DESCRIPTION
The V]jrunscriptR] command is a languag-independent comman-line
script shell.
The V]jrunscriptR] command supports both an interactive
(rea-eva-print) mode and a batch (V-fR] option) mode of script
execution.
By default, JavaScript is the language used, but the V-lR] option
can be used to specify a different language.
By using Java to scripting language communication, the
V]jrunscriptR] command supports an exploratory programming style.
If JavaScript is used, then before it evaluates a user defined script,
the V]jrunscriptR] command initializes certain buil-in functions
and objects, which are documented in the API Specification for
V]jrunscriptR] JavaScript buil-in functions.
OPTIONS FOR THE JRUNSCRIPT COMMAND
- V-cpR] I]pathR] or V-classpathR] I]pathR]
-
Indicates where any class files are that the script needs to access.
- V-DR]I]nameR]V]=R]I]valueR]
-
Sets a Java system property.
- V-JR]I]flagR]
-
Passes I]flagR] directly to the Java Virtual Machine where the
V]jrunscriptR] command is running.
- V-lR] I]languageR]
-
Uses the specified scripting language.
By default, JavaScript is used.
To use other scripting languages, you must specify the corresponding
script engine[aq]s JAR file with the V-cpR] or
V-classpathR] option.
- V-eR] I]scriptR]
-
Evaluates the specified script.
This option can be used to run on-line scripts that are specified
completely on the command line.
- V-encodingR] I]encodingR]
-
Specifies the character encoding used to read script files.
- V-fR] I]scrip-fileR]
-
Evaluates the specified script file (batch mode).
- V-f-R]
-
Enters interactive mode to read and evaluate a script from standard
input.
- V-helpR] or V-?R]
-
Displays a help message and exits.
- V-qR]
-
Lists all script engines available and exits.
ARGUMENTS
If arguments are present and if no V-eR] or V-fR] option
is used, then the first argument is the script file and the rest of the
arguments, if any, are passed as script arguments.
If arguments and the V-eR] or the V-fR] option are used,
then all arguments are passed as script arguments.
If arguments V-eR] and V-fR] are missing, then the
interactive mode is used.
EXAMPLE OF EXECUTING INLINE SCRIPTS
-
V]jrunscript-e [dq]print([aq]hello world[aq])[dq]R]
-
V]jrunscript-e [dq]cat([aq]http://www.example.com[aq])[dq]R]
EXAMPLE OF USING SPECIFIED LANGUAGE AND EVALUATE THE SCRIPT FILE
-
V]jrunscript-l js-f test.jsR]
EXAMPLE OF INTERACTIVE MODE
-
CB]
jrunscript
js> print([aq]Hello World[rs]n[aq]);
Hello World
js> 34 + 55
89.0
js> t = new java.lang.Thread(function() { print([aq]Hello World[rs]n[aq]); })
Thread[Threa-0,5,main]
js> t.start()
js> Hello World
js>
R]
RUN SCRIPT FILE WITH SCRIPT ARGUMENTS
In this example, the V]test.jsR] file is the script file.
The V]arg1R], V]arg2R], and V]arg3R] arguments are
passed to the script.
The script can access these arguments with an arguments array.
-
V]jrunscript test.js arg1 arg2 arg3R]
Index
- NAME
-
- SYNOPSIS
-
- DESCRIPTION
-
- OPTIONS FOR THE JRUNSCRIPT COMMAND
-
- ARGUMENTS
-
- EXAMPLE OF EXECUTING INLINE SCRIPTS
-
- EXAMPLE OF USING SPECIFIED LANGUAGE AND EVALUATE THE SCRIPT FILE
-
- EXAMPLE OF INTERACTIVE MODE
-
- RUN SCRIPT FILE WITH SCRIPT ARGUMENTS
-
|