>>>>>> Moses DeJong writes:
>
>    Moses> The CLASSPATH and LD_LIBRARY_PATH are set so that the
>    Moses> classes.zip file and the native libs are visible to the
>    Moses> JVM.
>
>Invocation doesn't use the CLASSPATH variable in 1.1. You
>should set the classpath from within you C program:
>
>JavaVM* vm;
>JNIEnv* env;
>JDK1_1InitArgs vm_args;
>vm_args.version = 0x00010001;
>
>JNI_GetDefaultJavaVMInitArgs(&vm_args);
>vm_args.classpath = "java_home/lib/classes.zip:.";
>
>JNI_CreateJavaVM(&vm, &env, &vm_args);
>
>
>
>        Juergen
>
>-- 
>Juergen Kreileder, Universitaet Dortmund, Lehrstuhl Informatik V
>Baroper Strasse 301, D-44221 Dortmund, Germany
>Phone: ++49 231/755-5806, Fax: ++49 231/755-5802


I am almost 100% sure that is not the problem. The CLASSPATH is getting
read in my C code and then it is passed into the JVM using the vm_args.
Here is a snip of the code I am using to call JNI_CreateJavaVM. I am
also sure that the CLASSPATH includes the classes.zip for JVM. Also
not that this exact same code works on Solaris and Windows versions
of the JDK from Sun.


static JavaVM *javaVM = NULL;
char *path, *newPath;
JDK1_1InitArgs vm_args;


        memset(&vm_args, 0, sizeof(vm_args));
        vm_args.version = 0x00010001;
        JNI_GetDefaultJavaVMInitArgs(&vm_args);

        path = getenv("CLASSPATH");
        if (path && vm_args.classpath) {
            oldSize = strlen(path);
            size = oldSize + strlen(vm_args.classpath);
            newPath = ckalloc(size+2);
            strcpy(newPath, path);
#ifdef __WIN32__
            newPath[oldSize] = ';';
#else
            newPath[oldSize] = ':';
#endif
            strcpy(newPath+oldSize+1, vm_args.classpath);
            vm_args.classpath = newPath;
        } else if (path) {
            vm_args.classpath = path;
        }

        if (JNI_CreateJavaVM(&javaVM, &currentEnv, &vm_args) < 0) {
                /* error condition */




At that point the JNI_CreateJavaVM returns an error code. Any ideas?



Thanks for the help!
mo dejong
dejong at cs.umn.edu

Reply via email to