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"));
}
}

