java and cocoa, exotic and rare drink mix


I saw on Apple and on other apple propaganda that you can implement the Cocoa API with java. Yet I have failed to find any example on Apple site, and on the O'Reilly Cocoa book they use, sigh, Object-C (what's that???), the other language capable of implementing the API.

Does anyone know where I can get examples, tutorials, any inkling of how to do so much as a HelloWorld Java implementation of this native API (funny how java, a supposedly cross-platform lang is used for a native API)?

Anyway, not soliciting opinion of how hot java is. Just want some samples if they exist.

Sure thang. Go Here: The java section has some nice tutorials about getting started. You should also install the developer tools, if you already haven't. If you want some more examples of Java-Cocoa code, just mount my iDisk public folder: my user name is fahrenba. There I have ported some of Apple's Objective-C examples to Java.

nice! :D I'm reading the Learning Cocoa book as we speak and I was just wondering how to do all this in Java. Thank you very much!

Objective C is pretty cool though, it's pretty easy if you allready know C++.
iDisk is apple's server space for users who subscribe to iTools (it's free). To sign up for it (u can host a webpage and get a email adress too), go to After that, go to the iDisk section and mount the public folder for fahrenba. The examples should be in there.

Somewhere beneath /Developer/... if you installed the Developer tools, are some Java examples. TextEdit for one. You can play with that.

You'll probably start learning Objective-C anyway since the documentation for that is better than for Java (the Cocoa docs that is).

At first I thought Objective-C was a cruel joke, but now I'm quite fond of it.

I tried last night to run that ToolBar java example that came with the Developer's tool and it gave me so many errors (looking for ProjectHeaders????).

Anyway, two questions for the developers in Java and Object-C:
1. Even though Java implements the native Cocoa API, apps written in Java for the Mac using this API still use a virtual machine or not? In the end, I want to see if there's a big performance difference. If java is just for syntax purpose and no jvm is required, then it should be fast....

2. Is there good source for learning Object-C? I looked at the Cocoa book from O'Reilly and got a momentary headache (where were the examples???).

You are crossing a lot of bounderies with that question, the answer is not as simple as you'd like.

1 If you're going to be doing java coping using the cocoa API's then your java is not portable. It depends on a specific environment implemented only in MacOS X which is wrapped around you magically if you create the appropriate project in Project Builder.

2 Any java code executes in a VM. There are no exceptions.

3 Java cocoa code ... the java you write executes in a VM, but there is a lot of C-code of some variety underneath doing all of the OS and window magic, making benchmarking in this environment ... hard.

4 There is also an actual java application runtime where even the windowing is provided either by the java code or by the VM, this is not as cool or aqua-esque when run on Mac OS X, but the code can be portable.

5 If you're going to be doing benchmarking, I'd recommend working on command line type stuff, avoiding the wierd hybrid overhead that is windowing. This way you're more likely to stress tho VM and not the windowing code.