Top


定義場所(file name)

jdk/src/windows/bin/java_md.c

説明(description)

/*
 * Load a jvm from "jvmpath" and initialize the invocation functions.
 */

名前(function name)

jboolean
LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
{

本体部(body)

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

        HINSTANCE handle;

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

        JLI_TraceLauncher("JVM path is %s\n", jvmpath);

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

        /*
         * The Microsoft C Runtime Library needs to be loaded first.  A copy is
         * assumed to be present in the "JRE path" directory.  If it is not found
         * there (or "JRE path" fails to resolve), skip the explicit load and let
         * nature take its course, which is likely to be a failure to execute.
         *
         */
        LoadMSVCRT();

  {- -------------------------------------------
  (1) LoadLibrary() を呼んで libjvm をロードする.

      (失敗したら, エラーを出力して JNI_FALSE をリターン)
      ---------------------------------------- -}

        /* Load the Java VM DLL */
        if ((handle = LoadLibrary(jvmpath)) == 0) {
            JLI_ReportErrorMessage(DLL_ERROR4, (char *)jvmpath);
            return JNI_FALSE;
        }

  {- -------------------------------------------
  (1) GetProcAddress() を呼んで, 
      JNI_CreateJavaVM() と JNI_GetDefaultJavaVMInitArgs() を取得する.

      (失敗したら, エラーを出力して JNI_FALSE をリターン)
      ---------------------------------------- -}

        /* Now get the function addresses */
        ifn->CreateJavaVM =
            (void *)GetProcAddress(handle, "JNI_CreateJavaVM");
        ifn->GetDefaultJavaVMInitArgs =
            (void *)GetProcAddress(handle, "JNI_GetDefaultJavaVMInitArgs");
        if (ifn->CreateJavaVM == 0 || ifn->GetDefaultJavaVMInitArgs == 0) {
            JLI_ReportErrorMessage(JNI_ERROR1, (char *)jvmpath);
            return JNI_FALSE;
        }

  {- -------------------------------------------
  (1) JNI_TRUE をリターン
      ---------------------------------------- -}

        return JNI_TRUE;
    }

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