Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main( void )
- {
- JavaVM *jvm;
- JNIEnv *env;
- JavaVMInitArgs vm_args;
- JavaVMOption* options = new JavaVMOption[1];
- options[0].optionString = const_cast<char *>("-Djava.class.path=.");
- vm_args.version = JNI_VERSION_1_6;
- vm_args.nOptions = 1;
- vm_args.ignoreUnrecognized = false;
- vm_args.options = options;
- int retVal = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
- if( retVal < 0 ) {
- printf("VM was not created successfully. Return code is %d.\n", retVal);
- return -1;
- } else
- printf("VM was created successfully.\n");
- delete options;
- jclass clsMain = env->FindClass("option/MainClass");
- if( clsMain == NULL ) {
- printf("Can't find MainClass class.\n");
- jvm->DestroyJavaVM();
- return -1;
- } else
- printf("Found Main class.\n");
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement