Beispiel #1
0
void *runSchedulingServer()
{
	logMessage("Starting up JVM...\n");
	if (!startJVM())
	{
		printf("Failed to start JVM.\n\n");
	}
}
DWORD WINAPI threadMain(LPVOID lpParam)
{
	if (!loadConfig())
    {
		logMessage("ERROR: Unable to load configuration.\n");
		return 0;
    }

	if (!generateClassPath())
	{
		logMessage("ERROR: Unable to generate classpath.\n");
		return 0;
	}
	
	startJVM();
	return 1;
}
Beispiel #3
0
/*--------------------------------------------------------------------------*/
BOOL InitializeJVM(void)
{
    BOOL bOK = FALSE;
    char *sciPath = NULL;

    sciPath = getSCI();

    if (!startJVM(sciPath))
    {
#ifdef _MSC_VER
        MessageBox(NULL, gettext("\nScilab cannot open JVM library.\n"), gettext("Error"), MB_ICONEXCLAMATION | MB_OK);
#else
        fprintf(stderr, _("\nScilab cannot open JVM library.\n"));
#endif
    }
    else
    {
        DoLoadLibrarypathInEtc(sciPath);
        DoLoadClasspathInEtc(sciPath);

        if (!createMainScilabObject())
        {
            char *errorMsg = os_strdup(gettext("\nScilab 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"));

            if (IsFromJava())
            {
                char *errorMsg2 = gettext("If Scilab is used from Java, make sure that your IDE (ex: Netbeans, etc) is not adding extra dependencies which could not be found at runtime.\n");
                char *tempMsg = (char*)MALLOC(sizeof(char) * (strlen(errorMsg) + strlen(errorMsg2) + 1));
                if (tempMsg)
                {
                    strcpy(tempMsg, errorMsg);
                    strcat(tempMsg, errorMsg2);
                    FREE(errorMsg);
                    errorMsg = tempMsg;
                }
            }
#ifdef _MSC_VER
            MessageBox(NULL, errorMsg, gettext("Error"), MB_ICONEXCLAMATION | MB_OK);
#else
            fprintf(stderr, "%s", errorMsg);
#endif
            if (errorMsg)
            {
                FREE(errorMsg);
                errorMsg = NULL;
            }
        }
        else
        {
            bOK = TRUE;
        }
    }

    if (sciPath)
    {
        FREE(sciPath);
        sciPath = NULL;
    }

    if (!bOK)
    {
        exit(1);
    }

    return TRUE;
}
Beispiel #4
0
int APIENTRY _tWinMain(HINSTANCE hInstance,
                     HINSTANCE hPrevInstance,
                     LPTSTR    lpCmdLine,
                     int       nCmdShow)
{
    TCHAR basedir[LAUNCHER_MAXPATH] = {0};
    TCHAR java[LAUNCHER_MAXPATH] = {0};
    TCHAR appFolder[LAUNCHER_MAXPATH] = {0};
    TCHAR java_escaped[LAUNCHER_MAXPATH] = {0};
    TCHAR jar[LAUNCHER_MAXPATH] = {0};
    LPTSTR *szArgList;
    int argCount;

    // Parse command line arguments to see if /Debug is there
    szArgList = CommandLineToArgvW(GetCommandLine(), &argCount);

    // [RT-31061] otherwise UI can be left in back of other windows
    AllowSetForegroundWindow(ASFW_ANY);

    enableDebugIfNeeded(argCount, szArgList);

    if (isDebug) {
        AllocConsole();
        SetConsoleOutputCP(CP_UTF8);
    }

    if (GetModuleFileNameW(NULL, basedir, LAUNCHER_MAXPATH) != 0) {
        TCHAR *end = _tcsrchr(basedir, '\\');
        if (end != NULL) {
            *end = 0;

            if (!getMainJar(basedir, jar, LAUNCHER_MAXPATH)) {
                showError(
                    (jar[0] == 0) ? _T("Failed to parse package configuration file") : jar,
                    _T("Failed to find main application jar!"));
                return -1;
            }

            getAppFolder(basedir, appFolder, LAUNCHER_MAXPATH);

            //DO Launch
            //this will concatenate arguments using space,
            // we need to make sure spaces are properly escaped if we have any
            _tchdir(appFolder);

            if (!startJVM(basedir, appFolder, jar, argCount, szArgList)) {
                showError(_T("Failed to launch JVM"), NULL);
                return -1;
            }
        }
    }

    if (szArgList != NULL) {
        LocalFree(szArgList);
    }

    if (isDebug) {
      showError(_T("Exiting application"), NULL);
    }
    return 1;
}