Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Problem with -Xmx option and JRE1.4.1

843829Jun 8 2004 — edited Jun 9 2004
the following code works with JRE1.3.1 but failed with JRE1.4.1 (Windows platform) :

...

JavaVMInitArgs args;
JavaVMOption cp[2];

HINSTANCE jvmDll= (HINSTANCE)NULL;

jint ( JNICALL JNI_CreateJavaVM)(JavaVM *pvm, void **penv, void *args);

cp[0].optionString = "-Djava.compiler=NONE";
cp[1].optionString = (char *)(LPCTSTR)MyClassPath;
cp[2].optionString = "-Xmx256M";
// For JRE1.3
args.version = JNI_VERSION_1_2;
// For JRE1.4
//args.version = JNI_VERSION_1_4;
args.nOptions = 3;
args.options = cp;
args.ignoreUnrecognized = JNI_TRUE;

// For JRE1.3.1
jvmDll = LoadLibrary("D:\\Program Files\\Java131\\jre\\bin\\classic\\jvm.dll");

// For JRE1.4.1
//jvmDll = LoadLibrary("D:\\Program Files\\Java141\\jre\\bin\\classic\\jvm.dll");

// --- Get the .DLL function address of JNI_CreateJavaVM
JNI_CreateJavaVM = (jint (JNICALL *)(JavaVM **, void **, void* ) ) GetProcAddress( jvmDll, "JNI_CreateJavaVM" );

// --- Create the VM
JNI_CreateJavaVM( &jvm, (void**) &env, &args )

...

I also tried to use -Xms256M and it works with both JRE.

Is this problem known ?

Thanks, Lionel.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 7 2004
Added on Jun 8 2004
2 comments
137 views