1jrunscript(1)               General Commands Manual              jrunscript(1)
2
3
4

Name

6       jrunscript - command line script shell
7

SYNOPSIS

9       jrunscript [ options ] [ arguments... ]
10
11

PARAMETERS

13          options
14             Options,  if  used,  should  follow immediately after the command
15             name.
16
17          arguments
18             Arguments, if used, should follow immediately  after  options  or
19             command name.
20
21

DESCRIPTION

23       jrunscript  is a command line script shell. jrunscript supports both an
24       interactive (read-eval-print) mode and a  batch  (-f  option)  mode  of
25       script  execution.  This  is a scripting language independent shell. By
26       default, JavaScript is the language used, but the -l option can be used
27       to  specify  a  different  language. Through Java to scripting language
28       communication, jrunscript supports "exploratory programming" style.
29
30       NOTE: This tool is experimental and may not be available in future ver‐
31       sions of the JDK.
32

OPTIONS

34          -classpath path
35             Specify  where  to find the user's .class files that are accessed
36             by the script.
37
38          -cp path
39             This is a synonym for -classpath path
40
41          -Dname=value
42             Set a Java system property.
43
44          -J<flag>
45             Pass <flag> directly to the Java virtual machine on  which  jrun‐
46             script is run.
47
48          -l language
49             Use  the  specified scripting language. By default, JavaScript is
50             used. Note that to use other scripting languages, you  also  need
51             to  specify  the corresponding script engine's jar file using -cp
52             or -classpath option.
53
54          -e script
55             Evaluate the given script. This option can be used  to  run  "one
56             liner" scripts specified completely on the command line.
57
58          -encoding encoding
59             Specify the character encoding used while reading script files.
60
61          -f script-file
62             Evaluate the given script file (batch mode).
63
64          -f -
65             Read  and  evaluate  a  script  from  standard input (interactive
66             mode).
67
68          -help
69             Output help message and exit.
70
71          -?
72             Output help message and exit.
73
74          -q
75             List all script engines available and exit.
76
77

ARGUMENTS

79       If [arguments...] are present and if no -e or -f option is  used,  then
80       the first argument is the script file and the rest of the arguments, if
81       any, are passed as script arguments. If  [arguments..]  and  -e  or  -f
82       option are used, then all [arguments..] are passed as script arguments.
83       If [arguments..], -e and -f are  missing,  interactive  mode  is  used.
84       Script  arguments are available to a script in an engine variable named
85       "arguments" of type String array.
86

EXAMPLES

88   Executing inline scripts
89       jrunscript -e "print('hello world')"
90       jrunscript -e "cat('http://java.sun.com')"
91
92
93   Use specified language and evaluate given script file
94       jrunscript -l js -f test.js
95
96
97   Interactive mode
98       jrunscript
99       js> print('Hello World\n');
100       Hello World
101       js> 34 + 55
102       89.0
103       js> t = new java.lang.Thread(function() { print('Hello World\n'); })
104       Thread[Thread-0,5,main]
105       js> t.start()
106       js> Hello World
107
108       js>
109
110
111   Run script file with script arguments
112       jrunscript test.js arg1 arg2 arg3
113
114
115       test.js is script file to execute and arg1, arg2 and arg3 are passed to
116       script  as  script arguments. Script can access these using "arguments"
117       array.
118

SEE ALSO

120       If JavaScript is used, then before evaluating any user defined  script,
121       jrunscript  initializes  certain  built-in functions and objects. These
122       JavaScript built-ins are documented in jsdocs @
123       http://docs.oracle.com/javase/7/docs/technotes/tools/share/jsdocs/all
124       classes-noframe.html.
125
126                                  16 Mar 2012                    jrunscript(1)
Impressum