Re: Mixing Obj-C & Java in same Cocoa app?
Re: Mixing Obj-C & Java in same Cocoa app?
- Subject: Re: Mixing Obj-C & Java in same Cocoa app?
- From: Tyler LaGrange <email@hidden>
- Date: Fri, 14 Sep 2001 22:10:14 -0400
On Thursday, September 13, 2001, at 11:53 AM, Ken Tabb wrote:
>
Hi,
>
I'm about to embark on an Obj-C Cocoa app which connects to a (Java)
>
WebObjects app running on another OS X box. Aside from the Obj-C / EOF
>
argument (which I can't take part in as I didn't use WO 4.x), and having
>
spoken to "WebObjects Ernie", it appears as though I need my Cocoa app
>
to
>
be either entirely Java (Cocoa and/or JDK Java) or a mix of Obj-C and
>
Java (Cocoa and JDK java). The reason for this is so that you use RMI or
>
other JDK Java-specific methods to communicate with the WebObjects app
>
on
>
the other machine.
>
>
I've not yet done a Cocoa app in Java, only Obj-C, but have looked
>
through the Temperature Converter app and it seems straightforward
>
enough. I'm used to 'normal' (JDK) Java, C, C++ (but would rather not)
>
and Obj-C (fave).
>
>
I'd like to know opinions on the following from bilingual Cocoa
>
veterans:
There really aren't that many veterans on this subject. The Java Cocoa
stuff seems fairly new to people on this list even though the WebObjects
stuff has been around for a while.
>
>
[1] How easy is it to mix Obj-C Cocoa and Java Cocoa in the same app?
Honestly I don't know this one and would like to hear about it myself.
I mostly use one or the other on apps but would like to learn to mix
them for the best of both worlds. I just haven't gotten to it yet.
>
>
[2] How easy is it to mix Cocoa Java and JDK (Sun) Java in the same app?
This is fairly easy to do. Essentially you just write your model and
controller classes in Suns Java - and just put the interface objects
together with the Cocoa API's. You can use existing jar files and
whatnot in your code...
>
>
[3] What are the limitations of [2]? In Public Beta you couldn't have
>
both JDK Java and Cocoa Java using the same screenspace / GUI, so one
>
had
>
to control the other... I'm wondering if this has improved since the
>
days
>
of Public Beta?
I never did any of this on the Public Beta...
>
>
[4] Is Cocoa ready for doing Java programming yet... when I last looked
>
at the docs (about 10.0.1 I think) there was a lot more implemented for
>
Obj-C than there was for Cocoa Java, but it seems to be much better now.
This is true in some aspects - and in others it is just a matter of
finding WHERE they put stuff. For example - when I recently tried to
learn how to use the NSBundle method to load up another nib:
(BOOL)loadNibNamed:(NSString *)aNibName owner:(id)owner
I found that this method in ObjectiveC is located in the "NSBundle
Additions" class in the Application Kit (whereas NSBundle itself is part
of the Foundation kit - which in and of itself made this method
unnecessarily hard to find). Well - in order to load the nib in Java
you have to find that this method:
public static boolean loadNibNamed(String aNibName, Object owner)
And that is in fact in the NSApplication Class under the Application Kit
(NOT TO MENTION that it isn't even documented/linked at the TOP of the
page under the Method Types heading where all the other methods are
placed. You have to search through the remainder of the document
yourself in order to find this priceless piece of information.)
This is just an example really. I think a majority of the classes that
are ESSENTIAL to writing Cocoa Apps are there - you just have no good
way of knowing it without reading ALL of the documentation provided by
Apple (and even then you will get VERY sick of seeing Description
Forthcoming). What would be useful is some document that helped point
out the major things that you will need - and where to find them in the
Java Classes. I have been contemplating trying to put something like
this together - but I just haven't gotten the time. You would THINK
that one of the Java Cocoa gurus at Apple would do something like this
for us.
>
>
[5] I'm assuming it's not possible to get at AltiVec from Java, as it's
>
interepreted by the JVM running on (presumably) the main CPU(s) and not
>
passed onto the AltiVec processors?
Probably not - but again - I don't really know. They are definitely
putting a lot of resources towards making Java run as fast as possible
on OSX - and maybe they will give some access to AltiVec someday. That
may be a better question for the java list....
Tyler
>
>
Thanks for any advice / words of warning,
>
the boy Ken
>
>
----------------------------------------------
>
Ken Tabb
>
Mac & UNIX Propellerhead & Network Bloke (Health & Human Sciences)
>
Computer Vision / Neural Network researcher (Computer Science)
>
University of Hertfordshire
>
e-mail: email@hidden
>
http://www.health.herts.ac.uk/ken/
>
>
Certified non-Microsoft Solution Provider
>
_______________________________________________
>
cocoa-dev mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/cocoa-dev