=?gb18030?B?u9i4tKO6IElzIGl0IHBvc3NpYmxlIHRvIHN0YXRp?= =?gb18030?B?YyBsaW5rIGp2bT8=?=

=?gb18030?B?SXNtbA==?= 76069016 at qq.com
Thu Sep 12 18:49:34 PDT 2013

OK, I got it. Thanks for your reply!

------------------ ԭʼÓʼþ ------------------
·¢¼þÈË: "Bob Vandette"; 
·¢ËÍʱ¼ä: 2013Äê9ÔÂ12ÈÕ(ÐÇÆÚËÄ) ÍíÉÏ11:43
ÊÕ¼þÈË: "Isml"<76069016 at qq.com>; 
³­ËÍ: "hotspot-dev"; 
Ö÷Ìâ: Re: Is it possible to static link jvm?

The hotspot sources do not currently support statically linking.   There are a number
of places in the hotspot sources that would have to be modified in order to support this.

It is only in JDK 8 that we modified the JNI and JVMTI specifications to allow statically linked
JNI libraries.  This is the first step in allowing a completely statically linked VM and Java runtime.


On Sep 12, 2013, at 5:17 AM, Isml wrote:

> Hi, everyone!
>     I am reading launcher code(hotspot7u\src\share\tools\launcher etc.) in the hotspot project and see some comments like this(in file hotspot7u\src\os\windows\launcher\java_md.c, line 434):
> jboolean
> LoadJavaVM(const char *jvmpath, InvocationFunctions *ifn)
> {
> #ifdef GAMMA
>    /* JVM is directly linked with gamma launcher; no Loadlibrary() */
>    ifn->CreateJavaVM = JNI_CreateJavaVM;
>    ifn->GetDefaultJavaVMInitArgs = JNI_GetDefaultJavaVMInitArgs;
>    return JNI_TRUE;
> #else
> It seems that jvm could be staticly linked. So I just do some try. After some tiny modifications, I successfully compiled it and link the jvm. But when I run it, it fails with error "unable to find jvm.dll". I debug the code, and find the actual reason why it failes(src\share\vm\runtime\os.cpp, line 385):
> void* os::native_java_library() {
>    dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "verify");
>    dll_load(buffer, ebuf, sizeof(ebuf));
>     // Load java dll
>    dll_build_name(buffer, sizeof(buffer), Arguments::get_dll_dir(), "java");
>    _native_java_library = dll_load(buffer, ebuf, sizeof(ebuf));
> verify.dll and java.dll is designed to be load here, and they all depends on jvm.dll!
> Now I do not how to do, any idea?


More information about the hotspot-dev mailing list