Re: Using NSClassFromString with a Custom Class
Re: Using NSClassFromString with a Custom Class
- Subject: Re: Using NSClassFromString with a Custom Class
- From: Steve Anderson <email@hidden>
- Date: Mon, 12 Jun 2006 22:29:47 +1000
Hi Andy
RE the Cocoa Dev Central link, I have defined the Classpath using the
values from the example I was following:
...
<key>NSJavaNeeded</key>
<string>YES</string>
<key>NSJavaRoot</key>
<string>Contents/Resources</string>
<key>NSJavaPath</key>
<array>
<string>JavaCompile.jar</string>
</array>
...
And as the Cocoa Dev Central link stated adding the JavaVM framework,
import statement and loading the VM explicitly is not required in
Cocoa apps, evident from the fact that my code using java.lang.String
works. I guess I need to write something like:
Class javaClass = NSClassFromString
(@"something.something.HelloWorldJava");
Thanks
Steve
www.submission.org
On 11 Jun 2006, at 11:56 PM, Andreas Monitzer wrote:
On Jun 11, 2006, at 15:48, Steve Anderson wrote:
In my Objective-C Cocoa app I am trying to use my custom Java
class 'HelloWorldJava', but it doesn't seem to be getting loaded
(or even found) using the following code:
Class javaClass = NSClassFromString(@"HelloWorldJava");
helloworldjava = [[javaClass alloc] init];
Yet, the following does work:
javaClass = NSClassFromString(@"java.lang.String");
NSString *aString = [[javaClass alloc] init];
Hi,
Take a look at this code:
http://trac.adiumx.com/browser/trunk/Plugins/joscar Service/
ESjoscarCocoaAdapter.m#L1524
Have you added your own jar-file to the jvm in this way?
You might also be interested in my article about the Java Bridge at
http://cocoadevcentral.com/articles/000024.php
andy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden