• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

multiple JVM from a single process

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Has anyone tried creating multiple JVMs in a single process? I am using jdk 1.4. and using C++ native methods to invoke the JVM.

To test, I tried 2 successive calls to

jint ret1 = JNI_CreateJavaVM(&_jvm1, (void **)&localJNIEnv1, &javaVMArgs);
jint ret2 = JNI_CreateJavaVM(&_jvm2, (void **)&localJNIEnv2, &javaVMArgs);

javaVMArgs is initialized correctly. ret1 = 0 indicating success. ret2 = -1 (JNI_ERR in jni.h, which is an unknown error). If there is a limitiation to create more than one JVM, then I'd have expected error returned to be -5 (JNI_EEXIST which means VM already created).

Java Invocation API doc http://java.sun.com/j2se/1.4.2/docs/guide/jni/spec/invocation.html mentions that "JDK 1.1.2 does not support creating more than one VM in a single process." in one place and "JDK 1.1 does not support creating more than one VM in a single process. " in another place. No mention of jdk 1.4 however.

If anyone has tried this successfully or has any ideas, I'd appreciate feedback. Thanks.
 
reply
    Bookmark Topic Watch Topic
  • New Topic