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!

Unable to find and initialize required class java/lang/Object

843829Oct 6 2003 — edited Oct 7 2003
I'm running a C++ program to execute a java class with the j9 virtual machine on QNX. Initially I had problems with the JNI_CreateJavaVM method returning an error code. Now it returns ok but I get an error "Fatal error: Unable to find and initialize required class java/lang/Object" which must be from the JVM. I've tried many settings of the CLASSPATH environment variable and the JavaVMInitArgs options but cannot get past it. I know the class file exists in /usr/eclipse/ive/lib/jclMax/classes.zip as well as other directories as listed in my code below. Why is it not found? Maybe the name of my environment variable is incorrect for this JVM, but I don't know what else to try, or whether there is another variable to set. Other variables which are set are "IVEHOME=/usr/eclipse/ive", "J9PLUGIN_ARGS='-jcl:max -DsystemClassLoader=com.ibm.oti.JxeBootstrapClassLoader -jxeshare:/j9plugin.jxe -debug". I have also tried various entries in LD_LIBRARY_PATH. This is my first time using the invocation interface.

Here is the code:
JNIEnv * pEnv;
JavaVM * pJvm;
jint iResult;

cout << "startJVM\n";
#ifdef JNI_VERSION_1_2
JavaVMInitArgs jvmInitArgs;
JavaVMOption joptions[1];
//joptions[0].optionString = "-Djava.class.path=/usr/eclipse/ive/lib/jclMax/classes.zip";

joptions[0].optionString = "-Djava.class.path=."
":/usr/eclipse/ive/lib"
":/usr/eclipse/ive/lib/jclMax"
":/usr/eclipse/ive/lib/jclMax/classes.zip"
":/usr/eclipse/ive/lib/jclFoundation"
":/usr/eclipse/ive/lib/jclCdc";

JNI_GetDefaultJavaVMInitArgs(&jvmInitArgs);
jvmInitArgs.version = 0x00010002;
jvmInitArgs.options = joptions;
jvmInitArgs.nOptions = 1;
jvmInitArgs.ignoreUnrecognized = JNI_TRUE;
// create JVM
iResult = JNI_CreateJavaVM(&pJvm, &pEnv, &jvmInitArgs);
#else
throw new TmConnectJNIException();
#endif
if (iResult < 0)
{
// cannot create VM
cerr << "Cannot create VM (err = " << iResult << ")\n";
throw new TmConnectJNIException();
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2003
Added on Oct 6 2003
1 comment
669 views