summaryrefslogtreecommitdiff
path: root/modules/javasci/help/en_US/javasci.xml
blob: 455bd2ce50934dc282ac447435a4e5e0a2193b8d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) 2008 - INRIA - Allan CORNET
 *
 * This file must be used under the terms of the CeCILL.
 * This source file is licensed as described in the file COPYING, which
 * you should have received as part of this distribution.  The terms
 * are also available at
 * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 *
 -->
<!-- This document was created with Syntext Serna Free. -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="javasci" xml:lang="en">
    <refnamediv>
        <refname>javasci</refname>
        <refpurpose>Call Scilab engine from a Java application</refpurpose>
    </refnamediv>
    <refsection>
        <title>Description</title>
        <para>Scilab offers the possibility to be called from a Java application.</para>
        <para>This help describes the features of the javasci API.</para>
        <para>
            Since Scilab version 5.3.0, a new version of Javasci called Javasci v2 has been introduced. This version fixes most of the <link linkend="javasci_v1_limitations">limitations of Javasci v1</link>.
        </para>
        <para>
            Browse <link type="remote" linkend="javasci/javadoc/index.html">the documentation of Javasci v2.</link> (this will open the web browser).
        </para>
    </refsection>
    <refsection>
        <title>Example of Javasci v2</title>
        <programlisting role="java"><![CDATA[
// A simple Java example with javasci v2
// Filename: DisplayPI.java

import org.scilab.modules.javasci.Scilab;
import org.scilab.modules.types.ScilabType;
import org.scilab.modules.types.ScilabDouble;

class Example1 {

    public static void main(String[] args) {

      try {
            Scilab sci = new Scilab();
            sci.open();
            sci.exec("disp(%pi);");

            ScilabDouble a = new ScilabDouble(3.14);
            sci.put("a",a);
            sci.exec("b=sin(a);");
            ScilabType b = sci.get("b");
            System.out.println("b = " + b);

            sci.close();

      } catch (org.scilab.modules.javasci.JavasciException e) {
            System.err.println("An exception occurred: " + e.getLocalizedMessage());
      }

    }
}

]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See Also</title>
        <simplelist type="inline">
            <member>
                Browse <link type="remote" linkend="javasci/javadoc/index.html">the documentation of Javasci v2.</link> (this will open the web browser).
            </member>
            <member>
                <link linkend="compile_and_run_javasci_v2">Compile and run with Javasci v2</link>
            </member>
            <member>
                <link linkend="javasci_faq_v2">Javasci v2 FAQ</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revdescription>
                    Javasci v1 is removed.
                </revdescription>
            </revision>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revdescription>New methods added:
                    <itemizedlist>
                        <listitem>Scilab.execException(String)
                            <para>Same as Scilab.exec(String) but returns an exception when a Scilab error occurs</para>
                        </listitem>
                        <listitem>Scilab.execException(String[])
                            <para>Same as Scilab.exec(String[]) but returns an exception when a Scilab error occurs</para>
                        </listitem>
                        <listitem>Scilab.execException(File)
                            <para>Same as Scilab.exec(File) but returns an exception when a Scilab error occurs</para>
                        </listitem>
                    </itemizedlist>
                </revdescription>
            </revision>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revdescription>
                    <itemizedlist>
                        <listitem>Javasci supports sparse and boolean sparse datatypes.</listitem>
                        <listitem>Javasci supports tlists, mlists and lists datatypes.</listitem>
                        <listitem>Javasci supports polynomial datatypes.</listitem>
                        <listitem>Javasci supports struct datatypes under the form of an mList.</listitem>
                    </itemizedlist>
                </revdescription>
            </revision>
        </revhistory>
    </refsection>
</refentry>