/*
*
*/voidCreateExecutionEnvironment(int*pargc,char***pargv,char*jrepath, jint so_jrepath,char*jvmpath, jint so_jvmpath,char*jvmcfg, jint so_jvmcfg){char* jvmtype;int i =0;int running = CURRENT_DATA_MODEL;int wanted = running;char** argv =*pargv;for(i =1; i <*pargc ; i++){//根据-J-d64/-J-d32判定用户准备运行的虚拟机是64位还是32位if(JLI_StrCmp(argv[i],"-J-d64")==0||JLI_StrCmp(argv[i],"-d64")==0){
wanted =64;continue;}if(JLI_StrCmp(argv[i],"-J-d32")==0||JLI_StrCmp(argv[i],"-d32")==0){
wanted =32;continue;}//IsJavaArgs()依据JAVA_ARGS是否定义(编译时生成: make/CompileLaunchers.gmk)//快速过滤java命令行参数//argv默认前面都是以'-'开始的java可选参数,自定义参数在java可选参数后if(IsJavaArgs()&& argv[i][0]!='-')continue;if(argv[i][0]!='-')break;}//如果目标运行环境与当前运行环境不匹配,打印异常信息if(running != wanted){//"Error: This Java instance does not support a %d-bit JVM.\nPlease install the desired version."JLI_ReportErrorMessage(JRE_ERROR2, wanted);exit(1);}/* Find out where the JRE is that we will be using. */if(!GetJREPath(jrepath, so_jrepath)){//"Error: Could not find Java SE Runtime Environment."JLI_ReportErrorMessage(JRE_ERROR1);exit(2);}//加载jvm.cfg配置文件//%JRE_HOME%\lib\${arch:amd64}\jvm.cfgJLI_Snprintf(jvmcfg, so_jvmcfg,"%s%slib%s%s%sjvm.cfg",
jrepath, FILESEP, FILESEP,(char*)GetArch(), FILESEP);/* Find the specified JVM type *///读取jvm.cfg到://static struct vmdesc *knownVMs = NULL;if(ReadKnownVMs(jvmcfg, JNI_FALSE)<1){//"Error: no known VMs. (check for corrupt jvm.cfg file)"JLI_ReportErrorMessage(CFG_ERROR7);exit(1);}//过滤命令行参数,获取jvm type
jvmtype =CheckJvmType(pargc, pargv, JNI_FALSE);//如果jvmtype所在配置的flag为:VM_ERROR,打印错误信息并退出进程if(JLI_StrCmp(jvmtype,"ERROR")==0){//"Error: could not determine JVM type."JLI_ReportErrorMessage(CFG_ERROR9);exit(4);}
jvmpath[0]='\0';//拼接jvmpath: %JRE_HOME%\\bin\\${jvmtype}\\java.dll//如果文件不存在,打印错误信息,并退出进程if(!GetJVMPath(jrepath, jvmtype, jvmpath, so_jvmpath)){//"Error: missing `%s' JVM at `%s'.\nPlease install or use the JRE or JDK that contains these missing components."JLI_ReportErrorMessage(CFG_ERROR8, jvmtype, jvmpath);exit(4);}/* If we got here, jvmpath has been correctly initialized. *//* Check if we need preload AWT */#ifdef ENABLE_AWT_PRELOAD
argv =*pargv;for(i =0; i <*pargc ; i++){/* Tests the "turn on" parameter only if not set yet. */if(awtPreloadD3D <0){if(GetBoolParamValue(PARAM_PRELOAD_D3D, argv[i])==1){
awtPreloadD3D =1;}}/* Test parameters which can disable preloading if not already disabled. */if(awtPreloadD3D !=0){if(GetBoolParamValue(PARAM_NODDRAW, argv[i])==1||GetBoolParamValue(PARAM_D3D, argv[i])==0||GetBoolParamValue(PARAM_OPENGL, argv[i])==1){
awtPreloadD3D =0;/* no need to test the rest of the parameters */break;}}}#endif/* ENABLE_AWT_PRELOAD */}
/*
* Returns the arch path, to get the current arch use the
* macro GetArch, nbits here is ignored for now.
*/constchar*GetArchPath(int nbits){#ifdef _M_AMD64return"amd64";#elif defined(_M_IA64)return"ia64";#elsereturn"i386";#endif}
#
#
#
# Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
# ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
#
# List of JVMs that can be used as an option to java, javac, etc.
# Order is important -- first in this list is the default JVM.
# NOTE that this both this file and its format are UNSUPPORTED and
# WILL GO AWAY in a future release.
#
# You may also select a JVM in an arbitrary location with the
# "-XXaltjvm=<jvm_dir>" option, but that too is unsupported
# and may not be available in a future release.
#
-server KNOWN
-client IGNORE