We help IT Professionals succeed at work.

JNI_createJavaVM always return JNI_ERR

ramalaks
ramalaks asked
on
Medium Priority
2,015 Views
Last Modified: 2013-12-22
I am using jdk1.5 and JNI_VERSION_1.4.
i am trying to create JVM as shown below
jint ret;
    char classpath[1024];
    JavaVMInitArgs  vm_args; /* VM initialization arguments */
    JavaVMOption options[1];
    sprintf(classpath, "-Djava.class.path=%s",USER_CLASSPATH);
    options[0].optionString = classpath;
    memset(&vm_args, 0, sizeof(vm_args));
    vm_args.version = JNI_VERSION_1_4; /* New in 1.1.2: VM version */
    vm_args.options = options;
    vm_args.nOptions = 1;
    vm_args.ignoreUnrecognized = JNI_TRUE;
    /* load and initialize a Java VM, return a JNI interface
     * pointer in env */
    ret = JNI_CreateJavaVM(&gJVM, (void**)&gJavaEnv, &vm_args);
    if (ret < 0)
    {
       dlogError("Can't create JVM. Error: %ld\n", ret);
       return;
    }

it always returns -1.  I have made my path to point to jvm.dll which in in jre/bin/client.  
what could be wrong?
Comment
Watch Question

> I have made my path to point to jvm.dll which in in jre/bin/client.

How did you do that?

It appears to me that its issue with jvm.dll

http://forum.java.sun.com/thread.jspa?threadID=656283