Re: Using Java and Objective-C from same app
Re: Using Java and Objective-C from same app
- Subject: Re: Using Java and Objective-C from same app
- From: Marc Pergand <email@hidden>
- Date: Wed, 18 Feb 2004 11:23:38 +0100
You can load, from ObjectiveC, any Java class and instantiate it:
NSJavaSetupVirtualMachine();
Class javaClass = NSClassFromString(@"MyJavaClass");
[[javaClass alloc]init];
see
http://cocoadevcentral.com/articles/000024.php for more details.
The reverse operation is more complicated, you can't load an ObjectiveC
class from Java, you need to deal with stubs files and the bridget app,
see
http://developer.apple.com/documentation/LegacyTechnologies/WebObjects/
WebObjects_3.1/Java/WrappingObjectiveC.html#REF13362
I tried this for a while with no success(obsolete?).
The only workaround is to use sendActionToTargetFromSender
(NSApplication), it allows you to call any Java or ObjectiveC class
method, see
http://perso.wanadoo.fr/mpergand/tutoriels/divers_exemples/en/
DoItOnMainThread.dmg as an example.
This problem has been discussed many times on this list, do some
searching with 'java bridge' keywords.
Marc.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.