Setting JVM properties, help.

I've problem of setting system properties to JVM.

My java program seems not running on the created JVM, so it cannot get the system properties set for the JVM. What the java program get is only the current enviroment "java.lang.class", rather than the one set in the C program.

Thanks for any clues of how to run the java program on the created JVM.

Many thnks,Lin

Here is my code:

/* C program */

#include <stdio.h>

#include "jni.h"

main() {

JNIEnv *env;

JavaVM *jvm;

jint res;

jclass cls;

JavaVMInitArgs Ia;

JavaVMOption my_option[3];

my_option[2].optionString =

"-Djava.class.path=.c:\\my_home\\my_class;

c:\\jdk1.3\\jre\\lib\\rt.jar;c:\\jdk1.3\\jre\\lib\\i18n.jar;";

my_option[0].optionString = "-DJAVA.COMPILER = NONE";

my_option[1].optionString = "-DIS_BOOT_SERVER=TRUE";

Ia.version = (jint)0x00010002;

Ia.options = my_option;

Ia.nOptions = 3;

Ia.ignoreUnrecognized = 0;

res = JNI_CreateJavaVM(&jvm,(void **)&env,&Ia);

if (res < 0) {

fprintf(stderr, "Can't create Java VM\n");

exit(1);

}

printf ("\nAfter creating JVM!\n");

printf ("\nIa.version is:%x\n",Ia.version);

printf ("\nIS_BOOT_SERVER is:%s\n",Ia.options[2]);

printf ("Ia.classpath is:%s\b",Ia.options[0]);

printf ("\nJIT complier mode:%s",Ia.options[1]);

}

/*Java Program */

class test{

public static void main(String[] args){

System.out.println("the java.class.path is" +

System.getProperty("java.class.path"));

System.out.println("the value of JIT mode is" +

System.getProperty("JAVA.COMPILER"));

System.out.println("the value of IS_BOOT_SERVER is"+ System.getProperty("IS_BOOT_SERVER"));

}

}

[1871 byte] By [linss] at [2007-9-26 5:47:41]
# 1
Is the problem with java.class.path or with all command line options?If with java.class.path, the code you posted has a syntax error for the option:"-Djava.class.path=.c:\\my_home\\my_classPresumably that should be "...=.;c:\\..."
jschell at 2007-7-1 14:11:26 > top of Java-index,Java HotSpot Virtual Machine,Specifications...
# 2
Sorry, the original one has ";". Actually After running the C program, it can find the class such as "java.lang.String", using FindClass routine, but when I use Java to get the system properties, all the return results are null.Thanks.
linss at 2007-7-1 14:11:26 > top of Java-index,Java HotSpot Virtual Machine,Specifications...