File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes invoking jvm on windows plat. through c Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "invoking jvm on windows plat. through c" Watch "invoking jvm on windows plat. through c" New topic

invoking jvm on windows plat. through c

vishal aggarwal

Joined: Jun 07, 2001
Posts: 1
Is there any difference while invoking java vm with jdk1.3 through c,is any new feature added in jni with jdk1.3
i am trying to invoke with the code follows but it does not work fine
#include <stdio.h>
#include <jni.h>
int mainn()
JavaVMOption options[2];
JavaVMInitArgs vm_args;
JavaVM *jvm;
JNIEnv *env;
long status;
jclass class_imadmin_Test;
jclass class_String;
jobjectArray args;
jmethodID id_main;
options[0].optionString="-D java.class.path=e:\\sakshi\\java\\classes";
vm_args.version = JNI_VERSION_1_2;
vm_args.options = options;
vm_args.nOptions = 2;
vm_args.ignoreUnrecognized = 1;

status=JNI_CreateJavaVM(&jvm,(void **)&env,&vm_args);
printf("Error in Creation Of Virtual Machine");
return 1;
id_main=(*env)->GetStaticMethodID(env,class_imadmin_Test,"main","([Ljava/lang/String V");
return 0;
I agree. Here's the link:
subject: invoking jvm on windows plat. through c
It's not a secret anymore!