Re: Mixing Cocoa and Cocoa-Java
Re: Mixing Cocoa and Cocoa-Java
- Subject: Re: Mixing Cocoa and Cocoa-Java
- From: Scott Ellsworth <email@hidden>
- Date: Mon, 6 Mar 2006 14:58:43 -0800
On Mar 6, 2006, at 2:48 PM, Rick Langschultz wrote:
I am trying to incorporate some jars into my program.
Look up JNI. It is pretty easy to use that to invoke java methods
and libraries with a bit of practice. I just finished writing
something that pushed a JMS message onto a queue from C, based on the
sample code Matt Drance showed at the last WWDC.
I don't want to port a java jar to c, or c++ so I was wondering if
Cocoa and Cocoa-Java or Cocoa and Java can be mixed while using
NIBs for interfacing.
Cocoa-java does exist and does work, but Apple has deprecated it and
suggested against using it for shipping applications. The preferred
way to use a Java library in Cocoa is to use Cocoa/ObjC (or PyObjC or
Camel Bones) for your front end and plain-jane JNI to call into the
Java routines. As long as they do something substantial enough to
cover the 1ms overhead of a JNI call, you should do fine.
I know Carbon and Cocoa can be mixed but is it the same for Cocoa
and Cocoa-Java?
I happen to like Java a great deal, and am a little hacked that Cocoa-
Java got deprecated, but deprecated it has been. Thus, I would not
recommend mixing Cocoa and Cocoa-Java. The docs, the team, sessions,
and web pages all indicate that using Java from Cocoa across JNI is
quite well supported, with the usual trade-offs. Further, the JVM
has gotten quite good on MacOS X, especially if you are not using
Java graphics, so it is not a bad way to use special purpose
libraries like Accelerate.
Scott
_______________________________________________
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