[Scilab-users] How to develop a Scilab-java application using apache-ant/apache-maven?
scheiber
scheiber at unitbv.ro
Wed Jan 2 18:14:22 CET 2013
How to develop a Scilab-java application using apache-ant/apache-maven?
Let us consider the following sample:
import org.scilab.modules.javasci.Scilab;
import org.scilab.modules.types.ScilabType;
import org.scilab.modules.types.ScilabDouble;
public class TstJavaSci1{
public static void main(String[] args){
try{
Scilab sci=new Scilab();
if(sci.open()){
sci.exec(new String[]{"u=1","v=u+1","disp(v)"});
sci.close();
}
else{
System.out.println("Could not start Scilab ");
}
}
catch(org.scilab.modules.javasci.JavasciException e) {
System.err.println("An exception occured: " +
e.getLocalizedMessage());
}
}
}
The execution may be carried out successfully with the following script
(Windows)
set SCILAB_HOME=c:\Program Files\scilab-5.4.0
set
SCILAB_PATH=%SCILAB_HOME%\modules\javasci\jar\org.scilab.modules.javasci.jar;%SCILAB_HOME%\modules\types\jar\org.scilab.modules.types.jar
set classpath=build;%SCILAB_PATH%;
rm build
md build
javac -d build src\TstJavaSci1.java
java TstJavaSci1
set SCILAB_HOME=c:\Program Files\scilab-5.4.0
set
SCILAB_PATH=%SCILAB_HOME%\modules\javasci\jar\org.scilab.modules.javasci.jar;%SCILAB_HOME%\modules\types\jar\org.scilab.modules.types.jar
set classpath=build;%SCILAB_PATH%;
rm build
md build
javac -d build src\TstJavaSci1.java
java TstJavaSci1
But if I tried to run with the apache-ant with the build.xml file
<?xml version='1.0' encoding='UTF-8'?>
<project name="proiect" basedir="." default="Run" >
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<path id="pathref">
<fileset dir="${lib.dir}">
<include name="*.jar"/>
</fileset>
<pathelement path="${build.dir}"/>
</path>
<target name="Init">
<delete dir="${build.dir}"/>
<mkdir dir="${build.dir}"/>
</target>
<target name="Compile" depends="Init">
<javac srcdir="src" destdir="${build.dir}"
includeantruntime="false">
<classpath refid="pathref" />
</javac>
</target>
<target name="Run" depends="Compile" >
<java classname="TstJavaSci1" fork="true">
<classpath refid="pathref" />
</java>
</target>
</project>
I get the following errors
Compile:
[javac] Compiling 1 source file to
d:\mk\NumerJava\NumerJavaX\Cap_2\Scilabv540\ant\build
Run:
[java] The native library javasci does not exist or cannot be found.
[java] java.lang.UnsatisfiedLinkError: C:\Program
Files\scilab-5.4.0\bin\javasci.dll: The specified procedure could not be
found
[java] at java.lang.ClassLoader$NativeLibrary.load(Native Method)
[java] at java.lang.ClassLoader.loadLibrary1(ClassLoader.java:1939)
[java] at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1864)
[java] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1854)
[java] at java.lang.Runtime.loadLibrary0(Runtime.java:845)
[java] at java.lang.System.loadLibrary(System.java:1084)
[java] at org.scilab.modules.javasci.Call_ScilabJNI.<clinit>(Unknown
Source)
[java] at
org.scilab.modules.javasci.Call_Scilab.SetFromJavaToON(Unknown Source)
[java] at org.scilab.modules.javasci.Scilab.initScilab(Unknown Source)
[java] at org.scilab.modules.javasci.Scilab.<init>(Unknown Source)
[java] at org.scilab.modules.javasci.Scilab.<init>(Unknown Source)
[java] at TstJavaSci1.main(Unknown Source)
[java] Exception in thread "main" java.lang.UnsatisfiedLinkError:
org.scilab.modules.javasci.Call_ScilabJNI.SetFromJavaToON()V
[java] at
org.scilab.modules.javasci.Call_ScilabJNI.SetFromJavaToON(Native Method)
[java] at
org.scilab.modules.javasci.Call_Scilab.SetFromJavaToON(Unknown Source)
[java] at org.scilab.modules.javasci.Scilab.initScilab(Unknown Source)
[java] at org.scilab.modules.javasci.Scilab.<init>(Unknown Source)
[java] at org.scilab.modules.javasci.Scilab.<init>(Unknown Source)
[java] at TstJavaSci1.main(Unknown Source).
The PATH of the system contains the reference “C:\Program
Files\scilab-5.4.0\bin”, while the lib folder contains the two required
jars.
The same errors are obtained using apache-maven.
--
View this message in context: http://mailinglists.scilab.org/How-to-develop-a-Scilab-java-application-using-apache-ant-apache-maven-tp4025606.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com.
More information about the users
mailing list