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: Leopard versions of NSArray and NSSpeechSynthesizer Java classes




On 14 Feb 2008, at 02:13, Mike Swingler wrote:

On Feb 13, 2008, at 3:24 PM, Peter Rootham-Smith wrote:

At Leopard a considerable amount of deprecation has happened to Apple's NSArray and NSSpeechSynthesizer classes. I would really like to see the Javadoc for these classes to understand things.

NSArray and NSSpeechSynthesizer are both classes that are part of "Java Bridge". These are Objective-C classes that are bridged to Java objects, but have been deprecated in Leopard, and not present in 64-bit VMs.

The supported way to access this functionality is to write JNI code that calls these native frameworks, and compile a universal binary that contains slices for ppc, i386, and x86_64. Our Java JNI application sample should be able to help you get started.

Please note that calling into Cocoa frameworks from the Java VM means that you will have to setup and tear down autorelease pools, catch NSExceptions, and -performSelectorOnMainThread, from native Objective-C code. This is not for the faint of heart. Most AppKit APIs are designed to be called from the main thread (thread 0), in much the same way Swing components should only be called from the Event Dispatch Thread (EDT). Of course - because life is hard - arbitrary client code cannot be run on thread 0, because it has to service the application's runloop, so you will have to bounce back and forth between multiple threads to get information back and forth to the Java VM.

I hope this helps clarify where things stand, even if it is not exactly comforting.

Mike Swingler
Java Frameworks Engineer
Apple Inc.

Thanks for the detailed and helpful response. Probably I should have guessed but Cocoa / Carbon are only names to me. Spawning a process to invoke Applescript would be perfectly acceptable save I don't think Applescript lets you write the spoke dialogue to a file. As long as things work until 10.6 that's fine - I'll probably rather try JNA than JNI. Deprecating stuff is unavoidable.


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden
References: 
 >Leopard versions of NSArray and NSSpeechSynthesizer Java classes (From: Peter Rootham-Smith <email@hidden>)
 >Re: Leopard versions of NSArray and NSSpeechSynthesizer Java classes (From: Mike Swingler <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.