Top


定義場所(file name)

jdk/src/share/bin/java.c

説明(description)

/*
 * Initializes the Java Virtual Machine. Also frees options array when
 * finished.
 */

名前(function name)

static jboolean
InitializeJVM(JavaVM **pvm, JNIEnv **penv, InvocationFunctions *ifn)
{

本体部(body)

  {- -------------------------------------------
  (1) (変数宣言など)
      ---------------------------------------- -}

        JavaVMInitArgs args;
        jint r;

  {- -------------------------------------------
  (1) args 局所変数を初期化しておく
      ---------------------------------------- -}

        memset(&args, 0, sizeof(args));
        args.version  = JNI_VERSION_1_2;
        args.nOptions = numOptions;
        args.options  = options;
        args.ignoreUnrecognized = JNI_FALSE;

  {- -------------------------------------------
  (1) (トレース出力)
      ---------------------------------------- -}

        if (JLI_IsTraceLauncher()) {
            int i = 0;
            printf("JavaVM args:\n    ");
            printf("version 0x%08lx, ", (long)args.version);
            printf("ignoreUnrecognized is %s, ",
                   args.ignoreUnrecognized ? "JNI_TRUE" : "JNI_FALSE");
            printf("nOptions is %ld\n", (long)args.nOptions);
            for (i = 0; i < numOptions; i++)
                printf("    option[%2d] = '%s'\n",
                       i, args.options[i].optionString);
        }

  {- -------------------------------------------
  (1) JNI_CreateJavaVM() を呼んで HotSpot の生成と初期化を行う.
      ---------------------------------------- -}

        r = ifn->CreateJavaVM(pvm, (void **)penv, &args);

  {- -------------------------------------------
  (1) 
      ---------------------------------------- -}

        JLI_MemFree(options);

  {- -------------------------------------------
  (1) 結果をリターン
      ---------------------------------------- -}

        return r == JNI_OK;
    }

This document is available under the GNU GENERAL PUBLIC LICENSE Version 2.