[Scilab-users] Question about javasci V2

Daniel Neutzler daniel.neutzler at haw-hamburg.de
Tue Jan 31 13:15:00 CET 2017


Hi, I am using Scilab 5.5.2 and trying to open a Scilab script from
Java. Therfore I followed the documentation: Compute and run with 
javasci v2.

I use Eclipse to compile and run. It works, but I want now to open it in 
"advanced mode"  to get grahpics
(*Scilab sci = new Scilab(true);*). If i do it, I get a compile Error. 
What's wrong ?
Code and Error Plot out see below.

Thank You for your Help,
Daniel Neutzler

####Error####
java.lang.ExceptionInInitializerError
     at org.scilab.modules.commons.xml.XConfiguration.<clinit>(Unknown 
Source)
     at org.scilab.modules.core.Scilab.<clinit>(Unknown Source)
     at org.scilab.modules.javasci.Call_ScilabJNI.Call_ScilabOpen(Native 
Method)
     at org.scilab.modules.javasci.Call_Scilab.Call_ScilabOpen(Unknown 
Source)
     at org.scilab.modules.javasci.Scilab.open(Unknown Source)
     at StartUp.main.main(main.java:17)
Caused by: java.lang.NullPointerException
     at java.io.File.<init>(Unknown Source)
     at org.scilab.modules.commons.ScilabConstants.<clinit>(Unknown Source)
     ... 6 more
Exception in thread "main"

#### JAVA Code####

package StartUp;
*import org.scilab.modules.javasci.Scilab;**
**import org.scilab.modules.types.ScilabType;*
import java.io.File;
import java.io.FileNotFoundException;

public class main {

     public static void main(String[] args) throws FileNotFoundException{
         System.out.println("Starte Programm Pin-Positionsanalyse-Tool 
V1.0...");

         try {
*Scilab sci = new Scilab(true); // Starts in advanced mode *
             if (sci.open()) {
             sci.execException(new 
File("C:/Users/Daniel/Desktop/test.sce"));
             sci.close();
              } else {
                  System.out.println("Could not start Scilab ");
              }
     /* Can be improved by other exceptions: AlreadyRunningException,
     * InitializationException, UndefinedVariableException,
     * UnknownTypeException, etc
     */
          } catch (org.scilab.modules.javasci.JavasciException e) {
              System.err.println("An exception occurred: " + 
e.getLocalizedMessage());
          }
     }
}

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20170131/a0cd7cb3/attachment.htm>


More information about the users mailing list