Scilab Home page | Wiki | Bug tracker | Forge | Mailing list archives | ATOMS | File exchange
Please login or create an account
Change language to: English - Português - 日本語

Please note that the recommended version of Scilab is 6.0.0. This page might be outdated.
However, this page did not exist in the previous stable version.

Aide Scilab >> Interface avec Java > Javasci v1 (deprecated) > javasci.Scilab (deprecated)

javasci.Scilab (deprecated)

This class provides the basic methods to execute Scilab code and scripts. Deprecated: Please use Javasci v2


This class is static. Since the Scilab environnement is persistant, all variables will remain accessible with the Java application.

Method Summary :

  • public static void Events() - Execute a Scilab event

  • public static boolean HaveAGraph() -Check if there is any scilab graphic window open (return True if it is the case).

  • public static boolean Exec(String job) - Execute a job in scilab. return true if there is no error.

    Note that the given expression must be consistent by itself. Then, a serie of Exec defining a function will not work. Please consider calling it with a single string instruction or using a temporary file with the method ExecuteScilabScript.

    For example: Scilab.Exec("function foo(); disp('bar'); endfunction"); will work when Scilab.Exec("function foo();"); Scilab.Exec("disp('bar');"); Scilab.Exec("endfunction;"); will not work since each statement being processed independently

  • public static native boolean ExistVar(String VarName)- Detect if VarName exists in Scilab. return true if Varname exist.

  • public static native int TypeVar(String VarName) - Return Scilab type of VarName. See type

  • public static native int GetLastErrorCode() - Return last Error code. See lasterror

  • public static boolean ExecuteScilabScript(String scilabscriptfilename)- Execute a scilab script (.sce) return true if there is no error.

  • public static native boolean Finish() - Terminate scilab (call scilab.quit , close a scilab object)


// A Scilab / Java example 
// Filename:

import javasci.Scilab;

public class ScilabExample {
	public static void main(String []args){
		String myVar="myVariable";
		Scilab.Exec(myVar+"=(%pi^4)/90;disp(myVariable);"); // Simple display
		if (Scilab.ExistVar(myVar)) {
			System.out.println("Variable "+myVar+" exists. Type: "+Scilab.TypeVar(myVar));
		if (!Scilab.Exec("disp(plop);")) { // Error
			System.err.println("Last error: "+Scilab.GetLastErrorCode()); // Error

See Also



Scilab Enterprises
Copyright (c) 2011-2017 (Scilab Enterprises)
Copyright (c) 1989-2012 (INRIA)
Copyright (c) 1989-2007 (ENPC)
with contributors
Last updated:
Wed Oct 05 12:11:04 CEST 2011