A
aa
Hello,
I create a Java virtual machine in a C++ application with
following settings:
....
string classPath = // any class path
JavaVMOption options[4];
options[0].optionString = const_cast<char*>(classPath.c_str());
options[1].optionString = const_cast<char*>("-Xmx512m");
options[2].optionString = const_cast<char*>("-Xss1m");
options[3].optionString = const_cast<char*>("-Xoss1m");
JavaVMInitArgs args;
args.version = JNI_VERSION_1_4;
args.nOptions = 4;
args.options = options;
args.ignoreUnrecognized = JNI_TRUE;
....
This part runs correctly and I get a valid virtual machine.
The problem is in the code below:
....
jClass = mEnv->FindClass("java/lang/String");
jConstructor = mEnv->GetMethodID(jClass, "<init>", "([B)V");
jInputObject = mEnv->NewObject(jClass, jConstructor);
....
and also here:
....
// 'len' is 7
jbyteArray jByteField = mEnv->NewByteArray(static_cast<jsize>(len));
....
In both of above cases an exception has been thrown
with this message:
Requested array size exceeds VM limit
I changed the maximum heap size (until 1 megabytes)
but without any result. What is wrong in my code? Must I
change any virtual machine settings?
Any idea?
Thanks in advance,
Anahita
I create a Java virtual machine in a C++ application with
following settings:
....
string classPath = // any class path
JavaVMOption options[4];
options[0].optionString = const_cast<char*>(classPath.c_str());
options[1].optionString = const_cast<char*>("-Xmx512m");
options[2].optionString = const_cast<char*>("-Xss1m");
options[3].optionString = const_cast<char*>("-Xoss1m");
JavaVMInitArgs args;
args.version = JNI_VERSION_1_4;
args.nOptions = 4;
args.options = options;
args.ignoreUnrecognized = JNI_TRUE;
....
This part runs correctly and I get a valid virtual machine.
The problem is in the code below:
....
jClass = mEnv->FindClass("java/lang/String");
jConstructor = mEnv->GetMethodID(jClass, "<init>", "([B)V");
jInputObject = mEnv->NewObject(jClass, jConstructor);
....
and also here:
....
// 'len' is 7
jbyteArray jByteField = mEnv->NewByteArray(static_cast<jsize>(len));
....
In both of above cases an exception has been thrown
with this message:
Requested array size exceeds VM limit
I changed the maximum heap size (until 1 megabytes)
but without any result. What is wrong in my code? Must I
change any virtual machine settings?
Any idea?
Thanks in advance,
Anahita