/*
We have been unable to instantiate a JVM via a "c" program running
on Suse Linux V7.0 with JDK1.3.0. Below is a sample "c" program to
instantiate the JVM. When the program runs, the following messages
are display:
>> Creating JVM
Cannot obtain system-specific information
>> JVM creation failed rc=-1
Has anyone seen the message "Cannot obtain system-specific information",
and knows what it means???
Below was how the program was compiled and linked and executed:
cc -c -o jvm.o -I/usr/lib/java/include jvm.c
cc -o jvm jvm.o -L/usr/lib/java/jre/bin/classic -ljvm
export LD_LIBRARY_PATH=/usr/lib/java/jre/bin/classic
./jvm
Thanks for any help!!!!
*/
#include <jni.h>
int main()
{
JavaVM *jvm;
JNIEnv *env;
JavaVMInitArgs vm_args;
JavaVMOption options[1];
jint res;
/* Create the JVM. */
options[0].optionString = "-Djava.class.path=./classes";
vm_args.nOptions = 1;
vm_args.options = options;
vm_args.version = JNI_VERSION_1_2;
vm_args.ignoreUnrecognized = 1;
printf(">> Creating JVM\n");
res = JNI_CreateJavaVM(&jvm, (void **)&env, &vm_args);
if (res < 0) {
printf(">> JVM creation failed rc=%d\n", res);
return res;
}
printf(">> JVM started okay...\n");
return 0;
}