Creating a JavaVM with JNI
Creating a JavaVM with JNI
- Subject: Creating a JavaVM with JNI
- From: Phil <email@hidden>
- Date: Thu, 3 Mar 2005 21:45:46 +1300
Hi,
Since using the Java Bridge is depreciated (and liable to get you
flamed), I'm attempting to use JNI in my Cocoa (Obj-C) application to
make some calls to a Java library.
For starters though, I'm just trying to get a basic JNI test going.
And thing's aren't looking too good.
I've included the JavaVM.Framework in my application and have copied
(almost verbatim) from the JNI Book up on java.sun.com the C example
to get JNI going -
JNIEnv *env;
JavaVM *jvm;
jint res;
JavaVMInitArgs vm_args;
JavaVMOption options[1];
options[0].optionString =
"-Djava.class.path=/Users/philip/Documents/Xcode";
vm_args.version = 0x00010002;
vm_args.options = options;
vm_args.nOptions = 1;
vm_args.ignoreUnrecognized = JNI_TRUE;
res = JNI_CreateJavaVM(&jvm, (void**)&env, &vm_args);
This compiles fine, however, res is always -1 (simply put, the virtual
machine fails to be loaded, there's nothing else I can get from it).
Does someone who has a bit more of a clue than me about this know how
to just get JNI to work?
Thanks,
Philip Q
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden