Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing Cocoa Java and Java AWT Q&A



On Feb 27, 2004, at 12:01 AM, Greg Bolsinga wrote:

Hello-

The amount of Cocoa Java and Java AWT mixing suggested on this mailing list is interesting. The posts on this list are the only times I've personally heard of mixing these two technologies together.

It's good to know that this combination is working for some users, but the Apple and Sun suggested way of accessing platform specific native specialties from java is by using JNI. Accordingly, Apple has just created an official Technical Q&A about this matter. <http://developer.apple.com/qa/qa2001/qa1342.html>


Its just a shame JNI sucks so much compared to JDirect or the unsupported Java Bridge.
All of the recent talk in the news about the idea of Java being open sourced is interesting. But their assumption that that's the major barrier keeping Java from growing into more areas is flawed.

The real barrier is that you can't easily bind Java to platform specific technologies if you've done you market research and decided that you want to write to one platform. Now Java is mature it should be both a language (useful for writing programs to any API) and a platform, for those that want the Write Once Run Anywhere side.

Writing Cocoa programs in Java is nice, but if we can't easily extend that to classes Apple doesn't have time to wrap for us - its a barrier for sure.

And I think that's why C# is gaining some momentum with Mono & dotgnu. The Linux dudes seem to want a "better" language to program their GNOME stuff in. That could have been Java, but the artificial restrictions keep that from happening. This has nothing to do with how open Java's license is, but much more to do with how Sun refuse to make it easy to call another language.

Such missed opportunities!

For example, there are places in Cocoa Java that won't mix with Java AWT, such as when executing on the main AppKit thread is required. Cocoa's -performSelectorOnMainThread simply isn't accessible via Cocoa Java's NSObject (as it is with Obj-C). Java AWT by design doesn't allow any client java code to be executed on the AppKit main thread (perhaps modulo some bugs). So mixing the two technologies can have troubles, and isn't suggested.

You know though, it occurs to me that using java.util.Executor from JDK 1.5, one could easily write an Executor that called -performSelectorOnMainThread: Hrm, might see if I have time to do that once 1.5 goes final.

AndyT (lordpixel - the cat who walks through walls)
A little bigger on the inside

(see you later space cowboy ...)
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Mixing Cocoa Java and Java AWT Q&A (From: Greg Bolsinga <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.