• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating a JavaVM with JNI
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Creating a JavaVM with JNI & Re:JavaBridge
      • From: "James B. Tuley" <email@hidden>
    • Re: Creating a JavaVM with JNI
      • From: Finlay Dobbie <email@hidden>
  • Prev by Date: Re: First day of week?
  • Next by Date: DotMacKit not prebound
  • Previous by thread: Re: Table Column Drawing Weirdness
  • Next by thread: Re: Creating a JavaVM with JNI
  • Index(es):
    • Date
    • Thread