2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) INRIA - Allan CORNET
4 * Copyright (C) DIGITEO - 2011 - Bruno JOFRET
6 * Copyright (C) 2012 - 2016 - Scilab Enterprises
8 * This file is hereby licensed under the terms of the GNU GPL v2.0,
9 * pursuant to article 5.3.4 of the CeCILL v.2.1.
10 * This file was originally licensed under the terms of the CeCILL v2.1,
11 * and continues to be available under such terms.
12 * For more information, see the COPYING file which you should have received
13 * along with this program.
17 /*--------------------------------------------------------------------------*/
19 #include "sci_malloc.h"
21 #include "addToClasspath.h"
22 #include "getClasspath.h"
23 #include "localization.h"
24 #include "freeArrayOfString.h"
25 #include "api_scilab.h"
26 /*--------------------------------------------------------------------------*/
27 int sci_javaclasspath(char *fname, void* pvApiCtx)
29 int *piAddressVarOne = NULL;
40 char **pstClasspath = NULL;
42 pstClasspath = getClasspath(&iRows);
43 createMatrixOfString(pvApiCtx, Rhs + 1, iRows, iCols, pstClasspath);
47 freeArrayOfString(pstClasspath, iRows * iCols);
51 sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddressVarOne);
54 printError(&sciErr, 0);
55 Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
59 sciErr = getVarType(pvApiCtx, piAddressVarOne, &iType);
62 printError(&sciErr, 0);
63 Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
67 if ( iType == sci_strings )
69 char **pStVarOne = NULL;
70 static int iCols = 0, iRows = 0;
73 if (getAllocatedMatrixOfString(pvApiCtx, piAddressVarOne, &iRows, &iCols, &pStVarOne))
75 Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
78 for (i = 0; i < iRows * iCols ; i++)
80 if (!addToClasspath(pStVarOne[i], STARTUP))
82 Scierror(999, _("%s: Could not add URL to system classloader : %s.\n"), fname, pStVarOne[i]);
83 freeArrayOfString(pStVarOne, iRows * iCols);
89 freeArrayOfString(pStVarOne, iRows * iCols);
93 Scierror(999, _("%s: Wrong type for input argument #%d: String expected.\n"), fname, 1);
99 /*--------------------------------------------------------------------------*/