Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problems in Scilab intigration with Swing application

11 views
Skip to first unread message

praveen

unread,
Nov 27, 2009, 2:12:59 AM11/27/09
to Niles...@geometricglobal.com, Rajesh....@geometricglobal.com
Hello
I am using scilab 5.1.1. I am calling a function written in scilab
from Java Swing application using javasci. The scilab function creates
an image and store in specified path. When I call this function from
Swing application, JVM crashes. If I call this function outside swing
application (using standalone Java class) then it works fine. I tried
to call this function using different thread on swing application then
the function works. But If I block the Swing thread and call the
function on different thread then function goes in wait state. In my
swing application I have to wait until scilab function completes its
execution.
I think this is happening because scilab uses swing for graphics
generation and this functionality crashes if scilab is called from
swing application. Is there any way to call the scilab function from
Swing application. on same thread? I am not getting why the scilab
function waits when I keep the Swing thread on wait state. Anyone
knows the solution/workaround for this issue?


The java code snippet that is calls the scilab function as follows

public void executeFunction() {
SciStringArray DataChars = new SciStringArray("DataChars", 3, 6,
new String[] { "Char 1", "Char 2", "Char 3", "0.15", "0", "0",
"0.1", "-0.1", "-0.2", "0.2", "0.1", "0.2", "0.95",
"0.95", "0.95", "%nan", "%nan", "%nan" });
SciString GifPath = new SciString("GifPath", "F:/Oasis/");
SciStringArray OutSynthesis = new SciStringArray
("OutSynthesis", 16, 4);
//this bin file has the foo function defined
Scilab.Exec("load 'F:/Oasis/Sci-lab/OASIS4_V3.bin';");
// foo is the custom functions which creates a graph and stored in the
GifPath
//At this point the JVM crashes
Scilab.Exec("[OutSynthesis]=foo(DataChars,GifPath)");
OutSynthesis.Get();
Scilab.Exec("disp(OutSynthesis)");
}

The error it throws by scilab when running on Swing thread is

Warning !!!
Scilab has found a critical error (Unknown exception)
with "set" function.
Save your data and restart Scilab.
Warning !!!
Scilab has found a critical error (Unknown exception)
with "stringbox" function.
Save your data and restart Scilab.
Error code after execution 21

0 new messages