• 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

invoking jvm on windows plat. through c

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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";
options[1].optionString="-Verbose:jni";
memset(&vm_args,0,sizeof(vm_args));
//memset(&options[0].optionString,0,sizeof(options[0].optionString));
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);
if(status==JNI_ERR)
{
printf("Error in Creation Of Virtual Machine");
return 1;
}
class_imadmin_Test=(*env)->FindClass(env,"Test");
id_main=(*env)->GetStaticMethodID(env,class_imadmin_Test,"main","([Ljava/lang/String V");
class_String=(*env)->FindClass(env,"java/lang/String");
args=(*env)->NewObjectArray(env,0,class_String,NULL);
(*env)->CallStaticVoidMethod(env,class_imadmin_Test,id_main,args);
(*jvm)->DestroyJavaVM(jvm);
return 0;
}
reply
    Bookmark Topic Watch Topic
  • New Topic