It won't create a Java VM (JNI)

前端 未结 2 1814
误落风尘
误落风尘 2021-01-14 02:44

My simple command line app:

int _tmain(int argc, _TCHAR* argv[])
{
 JavaVM *jvm;
 JNIEnv *env;
 JavaVMInitArgs vm_args;
 JavaVMOption options[1];
 options[0]         


        
相关标签:
2条回答
  • 2021-01-14 02:56

    In my experiance,

    Cause

    Maybe, JVM.DLL is located in below path.

    C:\Program Files\Java\jdk1.6.0_xx\jre\bin\client\ (a)

    and below folder contains many DLLs the JVM needs;

    C:\Program Files\Java\jdk1.6.0_xx\jre\bin\ (b)

    So, the JMV.DLL (that you dynamically linked) tries to search the all DLLs in its parent folder(b).

    Solution

    Don't copy JVM.DLL to the same folder in which your .exe is located!!!! Check you PATH system variable. It have to contain (a) and (b) paths. If so, maybe your .exe will be executed successfully.

    0 讨论(0)
  • 2021-01-14 03:18

    I think that your problem is answered by this question in the Sun JNI FAQ.

    TL;DR version: Don't move the JVM installation's DLLs.

    0 讨论(0)
提交回复
热议问题