Unable to use jReality with SCILAB

Have jReality programming problems or questions? Post them here.
Post Reply
karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Unable to use jReality with SCILAB

Post by karunaMaitri » Mon 28. May 2012, 02:18

Hello,

In the java application I am developing I need to use some of the functionality of SCILAB (with java interface javasci) along with jReality. Whenever I add the jReality project to the SCILAB javasci project in Eclipse, I get the following error (in SCILAB project).

Code: Select all

The native library javasci does not exist or cannot be found.
java.lang.UnsatisfiedLinkError: no javasci in java.library.path
If I do not add jReality project, SCILAB javasci works fine.

Here is the set up in Eclipse Indigo service release 2, on a Windows XP machine.

1. Set up jReality project (as indicated on the jReality web site).
2. Download and Install SCILAB 5.4.0 alpha 1 (nightly build) anywhere on windows machine.
3. Create an empty java project for SCILAB (in the same workspace as the jReality project) in Eclipse.
4. Set up javasci:
4a. Create "SCI" environment variable indicating the installation folder of SCILAB.
4b. Add the following jar files to "classpath":
org.scilab.modules.javasci.jar (in SciLab\modules\javasci\jar)
org.scilab.modules.types.jar (in SciLab\modules\types\jar)
4c. Add the SciLab\bin path to "path" variable.

The Example1.java (in SciLab\modules\javasci\examples\v2 can be used for testing) can be used for testing purposes.

Please let me know how I can fix this problem as this is very important for my application development.

Thank you!

Regards,
Karuna

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Mon 28. May 2012, 02:22

Additional required step in setting up the SCILAB project:

5. Add a "User Library" to Eclipse with jar files in step 4.
6. Add this "SCILAB User Library" to the SCILAB project.

Thanks!
Karuna

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: Unable to use jReality with SCILAB

Post by Andre » Thu 31. May 2012, 09:04

Hi karuna,

sorry for the late response. I don't have time yet, but hopefully I'll find some next week to rebuild your problem. Unfortunatly I don't have a windows computer, but It seems, that there is a linuxversion of scilab aswell, so I'll first try to to rebuild your problem with linux.

best
Andre

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Thu 31. May 2012, 18:10

Thanks Andre.
I tried the same set up with Scilab 5.3.3 (stable version). The same problem exists.

I look forward to receiving your reply.


Regards,
Karuna

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: Unable to use jReality with SCILAB

Post by Andre » Thu 21. Jun 2012, 16:51

Hi Karuna,

Sorry for the late response. I could rebuild your problem successfully ;)

Unfortunately I couldn't build a running version of SCILAB at all, even without jReality. I tried it via the make-file, eclipse and terminal. In all three cases I got the same "javasci not found" error.

Here comes the modified makefile out of the folder I've used:

Code: Select all

# A sample Makefile to build a Javasci v2-based application
# Path to Scilab data: /path/to/scilab/share/scilab/
SCI = /home/mongo/scilab-5.3.3/share/scilab
# Java API
CLASSPATH = $(SCI)/modules/javasci/jar/org.scilab.modules.javasci.jar:$(SCI)/modules/types/jar/org.scilab.modules.types.jar#:$(SCI)/modules/javasci/jar/javasci.jar: # also with this last include it isn't working...
# Path to native libs
LIB_PATH = $(SCI)/../../lib/scilab/
# Scilab binary: /path/to/scilab/lib/scilab/
# with the source version: $(SCI)/modules/javasci/.libs/:$(SCI)/modules/.libs/
all:
	javac -cp $(CLASSPATH) Example1.java
	java -cp $(CLASSPATH):. -DSCI=$(SCI) -Djava.library.path=$(LIB_PATH) Example1
With this I got a similar failure, but a bit more "specified":
The native library javasci does not exist or cannot be found.
java.lang.UnsatisfiedLinkError: /home/mongo/scilab-5.3.3/lib/scilab/libscilab.so.0.0.0: libsciparameters.so.5: cannot open shared object file: No such file or directory
....
Exception in thread "main" java.lang.UnsatisfiedLinkError: org.scilab.modules.javasci.Call_ScilabJNI.SetFromJavaToON()V
....
But of course the libscilab.so.0.0.0 exists there ;)
mongo@connor:~$ ls /home/mongo/scilab-5.3.3/lib/scilab/libscilab.so.0.0.0
/home/mongo/scilab-5.3.3/lib/scilab/libscilab.so.0.0.0
Could you really build a running scilab-version without jReality in classpath???

Scilab is only running when I'm using the execute-files from the scilab-bin-folder...

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Thu 21. Jun 2012, 17:18

Hi Andre, thank you for your reply. I need a small clarification. Why are you "rebuilding" Scilab? If you think that the solution lies in incorporating jReality into the build process of Scilab, then I will try rebuilding Scilab. I have not tried it before.

Thanks!
Karuna

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: Unable to use jReality with SCILAB

Post by Andre » Thu 21. Jun 2012, 17:57

I also haven't tried to rebuild scilab. The makefile doesn't do anything else like generating the classpath and libpath, building (javac) and running (java) the example1.java .

But I couldn't even run the example successfull.

So I'll rewrite my question: Do you have a running eclipse-version of scilab without jreality and have you tried to rebuild this in linux aswell?

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Thu 21. Jun 2012, 18:43

Yes, I have run several examples (I have rewritten old version v1 javasci examples to fit the v2 of scilab 5.3.3) successfully. They all work fine. But I have run them on Windows. I have not run them on Linux.

I tried to reproduce the set up on Windows. I do not know much about Linux set up for scilab. May be the following web page can provide the information you are looking for.
http://help.scilab.org/docs/5.3.3/en_US/compile_and_run_javasci_v2.html

Please let me know if I can help in any way.

Thanks!
Karuna

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: Unable to use jReality with SCILAB

Post by Andre » Sun 24. Jun 2012, 17:55

Finally I got it running!

The missing link was found here:
http://help.scilab.org/docs/5.3.3/en_US ... aq_v2.html
If the error is something like: java.lang.UnsatisfiedLinkError: /path/to/scilab/lib/scilab/libscilab.so.0.0.0: libsciparameters.so.5: cannot open shared object file: No such file or directory, try to set LD_LIBRARY_PATH to the path where Scilab native libraries are.
So I had to set the the variable LD_LIBRARY_PATH to the lib/scilab folder. In the Makefile I already have set the LIB_PATH to /home/mongo/scilab_5.3.3/lib/scilab

Code: Select all

LIB_PATH = /home/mongo/scilab-5.3.3/lib/scilab
LD_LIBRARY_PATH = $LIB_PATH
For eclipse I had to set LD_LIBRARY_PATH like the SCI variable in the "Run Configuration"

like you did in your first post:
4a. Create "SCI" environment variable indicating the installation folder of SCILAB.
SCI = /home/mongo/scilab-5.3.3/share/scilab
LD_LIBRARY_PATH= /home/mongo/scilab-5.3.3/lib/scilab
Afterwards I added jReality to the Repository and I could still use scilab.

I hope this will solve your problems too.

best regards
Andre

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Mon 25. Jun 2012, 01:38

Thanks Andre!

As I understand LD_LIBRARY_PATH is equivalent to PATH environment variable in Windows.

Anyway I tried declaring (both PATH and) LD_LIBRARY_PATH in windows. The result is the same (that is, it did not work - gave the same error as before).

There is also differences in directory trees between Linux and Windows for Scilab. For example, there is no "lib" directory, there is "libs" directory and its contents are different.

I am not sure how to proceed from here. Do you have any ideas?

Thanks!
Karuna

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: Unable to use jReality with SCILAB

Post by Andre » Mon 25. Jun 2012, 17:19

Hmmm, yes, you are right. The PATH-variable seems to be the "LD_LIBRARY_PATH"-variable for windows and the equivalent for the lib-folder seems to be the bin-folder in Windows. I've installed scilab with wine to check that. As far as I can remember I have an old win-xp-cd at home. I'll install it at the evening/weekend and test it with scilab+jreality. I'll find hopefully a solution for you...

best
Andre

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Mon 25. Jun 2012, 18:02

Thank you very much! I really appreciate it!

Karuna

Andre
Posts: 226
Joined: Fri 18. Sep 2009, 11:30

Re: Unable to use jReality with SCILAB

Post by Andre » Mon 25. Jun 2012, 21:42

Hi karuna,

I tried to rebuild your first post from scratch once more with my linux system. Now I'm getting the same result like you. I don't know why I wrote before, that both projects are running if I add jReality to scilab. But now I'm quite certain what's the problem.

jReality and Scilab are using different JNI-files. They are kind of blocking each other. (jReality uses the jni-files from the jni-folder -> e.g. jni/windows32, the JNI-files for Scilab is defined in the PATH-variable -> e.g. path/to-scilab/bin (for windows))

I think the aim have to be combining these JNI-Files in one folder linking to the folder from jReality and scilab and get it somehow running.

I already combined the jni-files and got scilab running via terminal. But unfortunately It wasn't running from eclipse, but at least I didn't get error anymore and the scilab-variable "SciLab sci = new SciLab();" was defined, but didn't start... I'll report you my further progress...

karunaMaitri
Posts: 90
Joined: Sun 16. Nov 2008, 00:24

Re: Unable to use jReality with SCILAB

Post by karunaMaitri » Tue 26. Jun 2012, 01:08

Hi Andre, that is a great breakthrough. Thanks!

I look forward to receiving your message about further developments.

Thanks!
Karuna

Post Reply