1 /*-----------------------------------------------------------------------------------*/
4 /*-----------------------------------------------------------------------------------*/
8 #include "InitializeJVM.h"
9 #include "loadClasspath.h"
10 #include "loadLibrarypath.h"
11 #include "setgetSCIpath.h"
14 #include "createMainScilabObject.h"
15 /*-----------------------------------------------------------------------------------*/
16 static void DoLoadClasspathInEtc(char *SCIPATH);
17 static void DoLoadLibrarypathInEtc(char *SCIPATH);
18 /*-----------------------------------------------------------------------------------*/
19 BOOL InitializeJVM(void)
26 bOK=startJVM(SCIPATH);
31 MessageBox(NULL,"Scilab cannot open JVM library.","Error",MB_ICONEXCLAMATION|MB_OK);
33 printf("\nError : Scilab cannot open JVM library.\n");
38 DoLoadLibrarypathInEtc(SCIPATH);
39 DoLoadClasspathInEtc(SCIPATH);
41 bOK = createMainScilabObject();
46 MessageBox(NULL,"Scilab cannot create Scilab Java Main-Class. (we have not been able to find the main Scilab class. Check if the Scilab and thirdparty packages are available).","Error",MB_ICONEXCLAMATION|MB_OK);
48 printf("\nError : Scilab cannot create Scilab Java Main-Class. (we have not been able to find the main Scilab class. Check if the Scilab and thirdparty packages are available).\n");
53 if (SCIPATH) {FREE(SCIPATH);SCIPATH=NULL;}
59 /*-----------------------------------------------------------------------------------*/
60 static void DoLoadClasspathInEtc(char *SCIPATH)
62 #define XMLCLASSPATH "%s/etc/classpath.xml"
63 char *classpathfile = NULL;
64 classpathfile = (char*)MALLOC(sizeof(char)*(strlen(SCIPATH)+strlen(XMLCLASSPATH)+1));
65 sprintf(classpathfile,XMLCLASSPATH,SCIPATH);
66 LoadClasspath(classpathfile);
67 if (classpathfile) {FREE(classpathfile); classpathfile = NULL;}
69 /*-----------------------------------------------------------------------------------*/
70 static void DoLoadLibrarypathInEtc(char *SCIPATH)
72 #define XMLLIBRARYPATH "%s/etc/librarypath.xml"
73 char *librarypathfile = NULL;
74 librarypathfile = (char*)MALLOC(sizeof(char)*(strlen(SCIPATH)+strlen(XMLLIBRARYPATH)+1));
75 sprintf(librarypathfile,XMLLIBRARYPATH,SCIPATH);
76 LoadLibrarypath(librarypathfile);
77 if (librarypathfile) {FREE(librarypathfile); librarypathfile = NULL;}
79 /*-----------------------------------------------------------------------------------*/