bug fix 14901: WScilex.exe stops immediately when launched from Java
[scilab.git] / scilab / modules / core / help / en_US / scilab.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
3           xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml"
4           xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook"
5           xmlns:scilab="http://www.scilab.org" xml:id="scilab" xml:lang="en">
6     <refnamediv xml:id="wscilex">
7     </refnamediv>
8     <refnamediv xml:id="scilex">
9     </refnamediv>
10     <refnamediv>
11         <refname>scilex | scilab</refname>
12         <refpurpose>runs Scilab in interactive or batch mode with command line options
13         </refpurpose>
14     </refnamediv>
15     <refsynopsisdiv>
16         <title>Syntax</title>
17         <synopsis>
18 #      MS Windows          |  # Linux / Unix / Mac OS X
19 wscilex     &lt;Options&gt;     |  scilab         &lt;Options&gt;
20 wscilex-cli &lt;Options&gt; |  scilab-adv-cli &lt;Options&gt;
21 scilex      &lt;Options&gt;      |  scilab-cli     &lt;Options&gt;
22         </synopsis>
23     </refsynopsisdiv>
24     <refsection role="arguments">
25         <title>Options</title>
26         <variablelist>
27             <varlistentry>
28                 <term>-args arg#1 arg#2 ..</term>
29                 <listitem>
30                     <para>
31                         This option allows to send some data to the Scilab session:
32                         <itemizedlist>
33                             <listitem>Consecutive data are separated by one or several spaces.
34                             </listitem>
35                             <listitem>An expression between double-quotes is a single data.
36                             </listitem>
37                             <listitem>To include a double-quote in a data, write <literal>\"</literal> instead of <literal>"</literal>.
38                             </listitem>
39                             <listitem>The single quote <literal>'</literal> is a regular character. It has no special meaning.
40                             </listitem>
41                         </itemizedlist>
42                     </para>
43                     <para>
44                       Inside the opened session, these data can be retrieved as separated strings with <link linkend="sciargs">sciargs()</link>.
45                      </para>
46                      <para>
47                       Example:
48                         <screen><![CDATA[C:\Users\Me> scilex -nb -noatomsautoload -args "Hello \"%USERNAME%\"" 1.2345 \"%cd%\"]]></screen>
49                         <programlisting><![CDATA[
50 // Inside the opened session:
51 a = sciargs()
52 i = find(a=="-args")
53 a(i+1)
54 evstr(a(i+2))*2
55 "This session has been launched from " + a(i+3)
56                         ]]>
57                         </programlisting>
58                         <screen><![CDATA[
59 --> // Inside the opened session:
60 --> a = sciargs()
61  a  =
62 !c:\SCIdir\bin\scilex  -nw  -nb  -noatomsautoload  -args  Hello "John"  1.2345  "C:\Users\Me" !
63
64 --> i = find(a=="-args")
65  i  =
66     5.
67
68 --> a(i+1)
69  ans  =
70  Hello "John"
71
72 --> evstr(a(i+2))*2
73  ans  =
74     2.469
75
76 --> "This session has been launched from " + a(i+3)
77  ans  =
78  This session has been launched from "C:\Users\Me"
79
80 -->
81 ]]></screen>
82                      </para>
83                      <para>
84                      <note>Using <literal>-args</literal> as the <emphasis role="italic">last</emphasis> command line option is safer.
85                      </note>
86                      </para>
87                 </listitem>
88             </varlistentry>
89             <varlistentry>
90                 <term>-display Display</term>
91                 <listitem>
92                     <para>
93                         For use under Xwindow systems only to set a specific X server
94                         display. Default display is unix:0.0.
95                     </para>
96                     <para>
97                         <literal>-display</literal> can be abbreviated by
98                         <literal>-d</literal>.
99                     </para>
100                 </listitem>
101             </varlistentry>
102             <varlistentry>
103                 <term>-e Instructions</term>
104                 <listitem>
105                     <para>
106                         At the end of the whole session startup, this option
107                         <itemizedlist>
108                             <listitem>
109                                 <para>sets the current working directory to the shell directory from which Scilab has been launched. Please see the example given here-below for the <literal>-f</literal> option. Then,
110                                 </para>
111                             </listitem>
112                             <listitem>
113                                 <para>executes Scilab <literal>Instructions</literal> provided in a string. Example:
114                                     <screen><![CDATA[ scilab-cli -e  "disp(\"Hello\"); a=%pi+%i; disp(exp(a)); exit;" -nb]]></screen>
115                                 </para>
116                             </listitem>
117                         </itemizedlist>
118                     </para>
119                     <warning>
120                         <literal>-e</literal> and <literal>-f</literal> options can't be used together.
121                     </warning>
122                 </listitem>
123             </varlistentry>
124             <varlistentry>
125                 <term>-f file</term>
126                 <listitem>
127                     <para>
128                         If this option is used, then at the beginning of the Scilab session, after the execution of the scilab and user startup files, and after the setting of user Preferences -- including the working directory ones --,
129                         <itemizedlist>
130                             <listitem>
131                                 <para>
132                                     the current Scilab working directory is set to the shell directory from which Scilab has been launched. For instance,
133                                     <screen><![CDATA[ D:\users\me\scilab\dev> C:\scilab-5.5.2\bin\scilex -f ..\test.sce]]></screen>
134                                     will do a <literal>cd("D:\users\me\scilab\dev")</literal>.
135                                 </para>
136                             </listitem>
137                             <listitem>
138                                 <para>
139                                     the Scilab script <literal>file</literal> is executed. If a relative path is used (default <literal>.\</literal>, or like <literal>..\</literal> in the sample here-above), it refers to the new Scilab working directory.
140                                 </para>
141                             </listitem>
142                         </itemizedlist>
143                     </para>
144                     <para>
145                         A file with .xcos extension will be opened by Xcos.
146                     </para>
147                 </listitem>
148             </varlistentry>
149             <varlistentry>
150                 <term>-quit</term>
151                 <listitem>
152                     <para>
153                         This option forces scilab to always exit after the instruction(s) passed with the <literal>-e</literal>
154                         option, or the script referred to by the <literal>-f</literal> option, have been executed,
155                         even in case of a runtime error. This option should always be used in batch mode.
156                         It is ignored if neither <literal>-e</literal> nor <literal>-f</literal> options are present.
157                     </para>
158                 </listitem>
159             </varlistentry>
160             <varlistentry>
161                 <term>-l lang</term>
162                 <listitem>
163                     <para>If this option is present it fixes the user language.
164                         <emphasis>lang</emphasis> can be: <emphasis>ca_ES de_DE en_US es_ES
165                             fr_FR ja_JP pt_BR ru_RU zh_CN zh_TW
166                         </emphasis> (from Scilab 5.2).
167                     </para>
168                     <para>
169                         Other possible <literal>lang</literal> values are
170                         <literal>'fr'</literal> for french and <literal>'en'</literal> for
171                         English for compatibility reasons. The default language is English.
172                         This default value is fixed the <literal>scilab.start</literal> file.
173                     </para>
174                     <para>On some systems, locales must be compiled to render correctly
175                         UTF-8 fonts.
176                     </para>
177                     <para>Scilab can be also called the following way:</para>
178                     <screen><![CDATA[ LANG=ja_JP scilab
179  # equivalent to
180  scilab -l ja_JP
181 ]]></screen>
182                 </listitem>
183             </varlistentry>
184             <varlistentry>
185                 <term>-nb</term>
186                 <listitem>
187                     <para>"no banner": Cancels the display of the Scilab's loading message.
188                     </para>
189                 </listitem>
190             </varlistentry>
191             <varlistentry>
192                 <term>-ns</term>
193                 <listitem>
194                     <para>"No Startup files": Cancels the execution of the main startup file
195                         <literal>SCI/etc/scilab.start</literal> and of the user startup files
196                         <literal>SCIHOME/.scilab</literal>,
197                         <literal>SCIHOME/scilab.ini</literal>.
198                     </para>
199                     <para>This option will disable many features in Scilab (Only use if
200                         you know what you are doing).
201                     </para>
202                 </listitem>
203             </varlistentry>
204             <varlistentry>
205                 <term>-nouserstartup</term>
206                 <listitem>
207                     <para>Cancels the execution of the user startup files
208                         <literal>SCIHOME/.scilab</literal> and
209                         <literal>SCIHOME/scilab.ini</literal>.
210                     </para>
211                 </listitem>
212             </varlistentry>
213             <varlistentry>
214                 <term>-noatomsautoload</term>
215                 <listitem>
216                     <para>Cancels the autoloading of installed ATOMS modules at startup.</para>
217                 </listitem>
218             </varlistentry>
219             <varlistentry>
220                 <term>-nw</term>
221                 <listitem>
222                     <para>If this option is present, Scilab is started as command line
223                         with advanced features still available (graphics, export, xcos, scinotes, help browser, ...).
224                     </para>
225                     <para>
226                         From Scilab 5.2:
227                         <itemizedlist>
228                             <listitem>
229                                 <para>pipes are enabled for all operating systems (see the
230                                     examples for further details).
231                                 </para>
232                             </listitem>
233                             <listitem>
234                                 <para>Scilab distribution also provides a dedicated binary which
235                                     is doing the same as <literal>-nw</literal>:
236                                     <literal>scilab-adv-cli</literal> (Scilab Advanced Command Line Interpreter).
237                                 </para>
238                             </listitem>
239                         </itemizedlist>
240                     </para>
241                 </listitem>
242             </varlistentry>
243             <varlistentry>
244                 <term>-nwni / -nogui</term>
245                 <listitem>
246                     <important>
247                         This mode prevents loading the Java Virtual Machine.
248                         It starts faster and uses less memory. But then...
249                     </important>
250                     <warning>
251                         Scilab is started as command line interpreter without any advanced features
252                         requiring the JVM: graphics, export, xcos, scinotes, help browser, other
253                         java interfaces, the Java module,... are not available.
254                     </warning>
255                     <para>
256                         Since Scilab 5.2:
257                         <itemizedlist>
258                             <listitem>
259                                 <para>pipes are enabled for all operating systems (see the
260                                     examples for further details).
261                                 </para>
262                             </listitem>
263                         </itemizedlist>
264                         <itemizedlist>
265                             <listitem>
266                                 <para>Scilab distribution also provides a dedicated binary which
267                                     is doing the same as <literal>-nwni</literal>:
268                                     <literal>scilab-cli</literal> (Scilab Command Line Interpreter).
269                                 </para>
270                             </listitem>
271                         </itemizedlist>
272                     </para>
273                 </listitem>
274             </varlistentry>
275             <varlistentry>
276                 <term>-scihome dir</term>
277                 <listitem>
278                     <para>Forces SCIHOME to the <literal>dir</literal> directory. If the path
279                       includes some white space, it must be specified between double-quotes (no
280                       single quotes!).
281                     </para>
282                 </listitem>
283             </varlistentry>
284             <varlistentry>
285                 <term>--texmacs</term>
286                 <listitem>
287                     <para>This option is reserved for the external TeXMacs module.
288                         This one can be priorly installed with <code>atomsInstall('texmacs')</code>.
289                     </para>
290                 </listitem>
291             </varlistentry>
292             <varlistentry>
293                 <term>-version</term>
294                 <listitem>
295                     <para>displays the Scilab's version (before the main Scilab's startup).</para>
296                 </listitem>
297             </varlistentry>
298         </variablelist>
299     </refsection>
300     <refsection role="arguments">
301         <title>Additional options for Unix/Linux and Mac OS X</title>
302         <para>Advice: use theses options on a Scilab source tree.</para>
303         <variablelist>
304             <varlistentry>
305                 <term>-debug</term>
306                 <listitem>
307                     <para>Start Scilab under the debugger gdb.</para>
308                     <para>
309                         The variable <literal>SCILAB_GDB_OPT</literal> may be set to add custom options to gdb.
310                     </para>
311                 </listitem>
312             </varlistentry>
313             <varlistentry>
314                 <term>-debug-kdbg</term>
315                 <listitem>
316                     <para>Start Scilab under kdbg.</para>
317                 </listitem>
318             </varlistentry>
319             <varlistentry>
320                 <term>-profiling</term>
321                 <listitem>
322                     <para>Start Scilab under valgrind.</para>
323                     <para>The variable SCILAB_VALGRIND_OPT may be set to add custom options
324                         to valgrind (and override the existing valgrind options).
325                     </para>
326                 </listitem>
327             </varlistentry>
328             <varlistentry>
329                 <term>-profiling-visu</term>
330                 <listitem>
331                     <para>Start Scilab under callgrind.</para>
332                     <para>The variable SCILAB_VALGRIND_OPT may be set to add custom options
333                         to callgrind (and override the existing callgrind options).
334                     </para>
335                 </listitem>
336             </varlistentry>
337             <varlistentry>
338                 <term>-electric-fence</term>
339                 <listitem>
340                     <para>Start Scilab with the Electric Fence.</para>
341                 </listitem>
342             </varlistentry>
343         </variablelist>
344     </refsection>
345     <refsection role="description">
346         <title>Environment variables</title>
347         <variablelist>
348             <varlistentry>
349                 <term>SCIVERBOSE</term>
350                 <listitem>
351                     <para>
352                         If this variable is present, Scilab startup script will show a startup debug information.
353                         Mainly used for bug report and debugging purposes.
354                     </para>
355                 </listitem>
356             </varlistentry>
357             <varlistentry>
358                 <term>JAVA_HOME</term>
359                 <listitem>
360                     <para>
361                         Specify which Java to use. For example,
362                         <literal>JAVA_HOME=/usr/lib/jvm/java-7-openjdk/ scilab</literal> will start Scilab with Java 7.
363                     </para>
364                 </listitem>
365             </varlistentry>
366             <varlistentry>
367                 <term>SCI_DISABLE_TK</term>
368                 <listitem>
369                     <para>Disable Tk (but not Tcl) features.</para>
370                 </listitem>
371             </varlistentry>
372             <varlistentry>
373                 <term>SCI_JAVA_ENABLE_HEADLESS</term>
374                 <listitem>
375                     <para>
376                         Enable Java Headless VM (i.e. without GUI features).
377                     </para>
378                 </listitem>
379             </varlistentry>
380         </variablelist>
381     </refsection>
382     <refsection role="description">
383         <title>Java Virtual Machine options</title>
384         <warning>
385             The options described here-below are useless and are cancelled if the option <literal>-nwni</literal> is used.
386         </warning>
387         <para>Starting from Scilab 5.0, the graphical user interface (GUI) and the
388             build documentation are based on Java features. In some cases, it can be
389             important to edit the JVM options (Java Virtual Machine).
390         </para>
391         <para>These options are available in the
392             <emphasis>jvm_options.xml</emphasis> file.
393         </para>
394         <para>In version 5.0.X and 5.1.X, this file is stored as
395             <emphasis>SCI/modules/jvm/etc/jvm_options.xml</emphasis>.
396         </para>
397         <para>In version &gt;= 5.2.0, the file is available in
398             <emphasis>etc/jvm_options.xml</emphasis>.
399         </para>
400         <para>
401             <emphasis>
402                 By default, the three following options are
403                 easily accessible in the configuration file:
404             </emphasis>
405         </para>
406         <variablelist>
407             <varlistentry>
408                 <term>-XmxXXXm</term>
409                 <listitem>
410                     <para>This option set the amount of memory available by the Java
411                         Virtual Machine. By default, 256M are allocated. If you change this
412                         value, check that the value does not exceed the memory available on
413                         the system.
414                     </para>
415                     <para>Since Scilab 5.4.0, this value can be changed in the preferences menu.</para>
416                 </listitem>
417             </varlistentry>
418             <varlistentry>
419                 <term>-Djava.compiler=JIT</term>
420                 <listitem>
421                     <para>
422                         This option with the argument <emphasis>JIT</emphasis> enables
423                         the Java Just In Time compiler. It is activated by default.
424                         <emphasis>NONE</emphasis> disables the JIT and decreases
425                         dramatically performances.
426                     </para>
427                 </listitem>
428             </varlistentry>
429             <varlistentry>
430                 <term>-verbose:jni / -Xcheck:jni</term>
431                 <listitem>
432                     <para>These options enable more checks and output from the JNI
433                         calls. These options are useful in case of debugging and are
434                         disabled by default since they decreases performances.
435                     </para>
436                 </listitem>
437             </varlistentry>
438         </variablelist>
439         <para>Many more options are available. They can improve the performances,
440             change look and feel, change memory managements... See: <ulink url="http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html">http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html</ulink>.
441         </para>
442     </refsection>
443     <refsection role="examples">
444         <title>Examples</title>
445         <screen><![CDATA[
446 # Let's start Scilab in profiling mode without attaching a gdb once a SIGSEGV is met.
447 # We are under Bash shell
448 export SCILAB_VALGRIND_OPT="--db-attach=no --log-file=myfile.txt"
449 scilab -profiling
450
451 # Let's start Scilab in debug mode without stopping after each SIGSEGV
452 # First, we write a small command file
453 echo "handle SIGSEGV nostop" > debug.txt
454 # Now set the custom option
455 # We are under Bash shell
456 export SCILAB_GDB_OPT="--command=debug.txt"
457 # Start Scilab in debug mode
458 scilab -debug ]]></screen>
459         <para></para>
460         <screen><![CDATA[
461 # Under GNU/Linux, Mac OS X or Unix:
462 $ echo "disp(%pi)"|scilab-cli
463 or
464 $ echo "disp(%pi)"|scilab -nwni
465
466 # Only open the Scilab help window:
467 $ scilab-adv-cli -e "help()"
468 or
469 $ scilab -nw -e "help()"
470
471
472 # Scilab can be used for scripting aspects:
473 echo "if 1&lt;>2 then exit(99) end"|scilab-cli
474 echo $? ]]></screen>
475     </refsection>
476     <refsection role="see also">
477         <title>See also</title>
478         <simplelist type="inline">
479             <member>
480                 <link linkend="startup">startup</link>
481             </member>
482             <member>
483                 <link linkend="sciargs">sciargs</link>
484             </member>
485             <member>
486                 <link linkend="getpid">getpid</link>
487             </member>
488             <member>
489                 <link linkend="getenv">getenv</link>
490             </member>
491             <member>
492                 <link linkend="getversion">getversion</link>
493             </member>
494             <member>
495                 <link linkend="consolebox">consolebox</link>
496             </member>
497             <member>
498                 <link linkend="exit">exit</link>
499             </member>
500         </simplelist>
501     </refsection>
502     <refsection role="history">
503         <title>History</title>
504         <revhistory>
505             <revision>
506                 <revnumber>5.4.0</revnumber>
507                 <revremark>-noatomsautoload added.</revremark>
508             </revision>
509             <revision>
510                 <revnumber>5.4.1</revnumber>
511                 <revremark>scinotes and xcos individual scripts introduced. See SEP #87.</revremark>
512             </revision>
513             <revision>
514                 <revnumber>6.0.0</revnumber>
515                 <revremark>
516                     <literal>-quit</literal> option added. <literal>-mem</literal> option removed.
517                 </revremark>
518             </revision>
519             <revision>
520                 <revnumber>6.0.1</revnumber>
521                 <revremark>
522                     <literal>-scihome</literal> option added.
523                 </revremark>
524             </revision>
525         </revhistory>
526     </refsection>
527 </refentry>