[Scilab-users] Using Scilab cli from Java

Victor Noël victor.noel at irit.fr
Mon Oct 8 14:48:07 CEST 2012


Hi,

We need in a joint research/industrial project to run scilab functions
from Java. Since javasci does not allow multiple engine to run at the
same time (as we need each of these execution to be persistent during a
long time with global variables, and there could be name clashes between
them), we decided to spawn the scilab cli for each function and interact
with it using stdin and stdout.

This works well, but ONLY under windows.

For a reason we ignore, stdout does not seem to produce any output under
Linux. I defined a simple test case to illustrate the problem, it runs
under windows but not under Linux.

It is joined to this email.
Running it should produce the display of "test" in the console.

To illustrate the fact that the problem here is not linked to deadlocks
created by threads and a small stream buffer (as it is a famous reason
for this kind of problem), I put the reading of stderr and stdout in
threads.

What we noticed is the following:
 - closing stdin unblocks stdout (but makes the process useless)
 - redirecting stdout to a file does not work either
 - redirecting stdout to the java process's stdout does work!

I have the feeling this is linked Scilab itself and not just to the java
code responsible of executing processes, that's why I ask the question
here, but I may be wrong, and in that case, I'm sorry for the noise.

This is really blocking and I'm starting to get desperate about fixing
this (even more because I had a lot of hopes in porting our prototype to
Linux :)

Thank you for any help you can provide

Victor
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.java
Type: text/x-java
Size: 1811 bytes
Desc: not available
URL: <https://lists.scilab.org/pipermail/users/attachments/20121008/2acd40a8/attachment.bin>


More information about the users mailing list