Scilab Website | Contribute with GitLab | Mailing list archives | ATOMS toolboxes
Scilab Online Help
5.3.3 - English

Change language to:
Français - 日本語 - Português

Please note that the recommended version of Scilab is 2025.0.0. This page might be outdated.
See the recommended documentation of this function

Scilab help >> Java Interface > javasci

javasci

Call Scilab engine from a Java application

Description

Scilab offers the possibility to be called from a Java application.

This help describes the features of the javasci API.

Since Scilab version 5.3.0, a new version of Javasci called Javasci v2 has been introduced. This version fixes most of the limitations of Javasci v1.

Browse the documentation of Javasci v2. (this will open the web browser).

Example of Javasci v2

// 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());
      }

    }
}

Example of Javasci v1 (deprecated)

// A simple Java example with javasci v1
// Filename: DisplayPI.java
import javasci.Scilab;
public class DisplayPI {
        public static void main(String []args) {
               Scilab.Exec("disp(%pi);"); 
        } 
}

See Also

Authors

Allan Cornet

Sylvestre Ledru

<< Compile and run with javasci v2 Java Interface javasci FAQ >>

Copyright (c) 2022-2024 (Dassault Systèmes)
Copyright (c) 2017-2022 (ESI Group)
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:10:05 CEST 2011