title: JNI create JVM by selecting which jvm.dll to load
body: <p>I have several Java installations on my PC. Is it possible somehow to pass setting from which path jvm.dll should be loaded? Following code creates JVM using JNI:</p>
  
  <pre><code>void createJVM()
  {
  
  JavaVMInitArgs vm_args; 
  JavaVMOption options[4]; 
  
  int n = 0;     
  char * str;
  str= new char[1000];
  sprintf(str, "-Djava.class.path=%S\\tst.jar", myPath);
  options[n++].optionString = str; 
  
  str= new char[1000];
  sprintf(str, "-Djava.library.path=%S\\lib;%S", myPath, myPath);
  options[n++].optionString = str;
  
  str= new char[1000];
  sprintf(str, "-Duser.dir=%S", myPath);
  options[n++].optionString = str;
  
  vm_args.version = JNI_VERSION_1_4;
  vm_args.nOptions = n;     
  vm_args.options = options;     
  vm_args.ignoreUnrecognized = false;
  
  
  JNI_CreateJavaVM(&amp;jvm, (void**)&amp;env, &amp;vm_args); 
  }
  </code></pre>