Hi,
I'm using the code below to invoke the JVM. The code compiles and links Ok. When I
try to run the code, the CallStaticVoidMethod(cls,mid) returns an error (segmentation
violation).
I'm using JDK1.1.7 version 3 and Linux 6.1 (SUSE).
Does anybody know what causes this error ???
Thanks !!
E-Mail : [EMAIL PROTECTED]
#include <jni.h>
#include <stdio.h>
JavaVM *jvm;
JNIEnv *env;
JDK1_1InitArgs vm_args;
void main(int argc, char **argv)
{
printf("Creating the Java VM\n");
JNI_GetDefaultJavaVMInitArgs(&vm_args);
vm_args.classpath="/usr/jdk117_v3/lib/classes.zip:/home/test";
JNI_CreateJavaVM(&jvm, &env, &vm_args);
jclass cls = env->FindClass("Main");
jmethodID mid = env->GetStaticMethodID(cls, "main", "()V");
env->CallStaticVoidMethod(cls, mid);
if (env->ExceptionOccurred() != NULL) env->ExceptionDescribe();
jvm->DestroyJavaVM();
}
public class Main
{
public static void main(String[] args)
{
System.out.println("Running Java ...");
}
}
----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]