Re: [SOLVED] Re: calling Java for ObjC
Re: [SOLVED] Re: calling Java for ObjC
- Subject: Re: [SOLVED] Re: calling Java for ObjC
- From: Evan Schoenberg <email@hidden>
- Date: Thu, 6 Jan 2005 01:54:31 -0600
Hm, glad that worked for you. I tried the same and couldn't get the
JavaVM to ever load the newer version; the documentation seems to
indicate that these keys exist for double-clickable wrapped .jar files,
not for the framework. So what changed between it not working and it
now working?
-Evan
On Jan 5, 2005, at 10:40 PM, Byron Wright wrote:
Odd,
adding this in the info.plist now works, (it didn't work before uneven
after a clean rebuild).
<key>Java</key>
<dict>
<key>JVMVersion</key>
<string>1.4*</string>
</dict>
-Byron
Evan, my class was getting instantiated, i checked in the debugger. As
soon as my custom class attempted to call the apache soap API which in
turn instantiates an XML parsed it would fail, the stack trace from
the VM verifies that.
On Jan 5, 2005, at 8:32 PM, Evan Schoenberg wrote:
Are you sure
testSoap = [NSClassFromString(@"TestWeatherSoap") new];
is actually working? Try NSLog(@"testSoap: %@",testSoap); and see
what it's doing.
(Unsupported major.minor version 48.0)
This is quite likely (based on my experience) because the java class
you're loading requires Java 1.4.x. JavaVM.framework loads Java
1.3.1. I spent a -long- time trying to figure out how to get it load
Java 1.4.x to no avail... if you manage to get around this, -please-
post it to the list.
Hope that helps,
Evan
On Jan 5, 2005, at 8:23 PM, Byron Wright wrote:
I am attempting to instantiate and call Java classes from
Objective-C and I am running into the following error after
instantiating a Java class and when calling it's methods on Panther
:
2005-01-05 17:59:37.606 TechDemo[1297] An uncaught exception was
raised
2005-01-05 17:59:37.646 TechDemo[1297]
java/lang/UnsupportedClassVersionError: org/w3c/dom/Node
(Unsupported major.minor version 48.0)
Stack Trace:
java.lang.UnsupportedClassVersionError: org/w3c/dom/Node
(Unsupported major.minor version 48.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:488)
at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:
106)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:243)
at java.net.URLClassLoader.access$100(URLClassLoader.java:51)
at java.net.URLClassLoader$1.run(URLClassLoader.java:190)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:288)
at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
at TestWeatherSoap.getTemp(TestWeatherSoap.java:22)
at TestWeatherSoap.test(TestWeatherSoap.java:61)
2005-01-05 17:59:37.646 TechDemo[1297] *** Uncaught exception:
<java/lang/UnsupportedClassVersionError> org/w3c/dom/Node
(Unsupported major.minor version 48.0)
The following code generates the error:
- (id) init
{
if(self = [super init])
{
NSString * cp = [NSString
stringWithFormat:@"%@:%@",[NSJavaVirtualMachine
defaultClassPath],@"./soap.jar:./SoapTest.jar"]; //add apache soap
and my custom classes to classpath
NSLog(@"classpath = %@",cp);
jvm = [[NSJavaVirtualMachine alloc] initWithClassPath:cp];
testSoap = [NSClassFromString(@"TestWeatherSoap") new]; //works
fine
[self searchFor:@"98125"];
}
return self;
}
- (void) searchFor : (NSString * ) query
{
[testSoap test]; //causes error
}
The resources I have been able to find using google suggest that the
wrong version of the JVM is being instantiated. I found this info
here : http://www.cocoadev.com/index.pl?XcodeObjCJavaBridge
One possible solution and according to Apple's documentation
(http://developer.apple.com/documentation/Java/Conceptual/
Java141Development/index.html ) I should be able to add the
following to the info.plist file. However, this doesn't seem to
work. There doesn't seem to be much documentation on Apple's site
about NSJavaVirtualMachine and by looking at the header file I don't
see any may of specifying this when creating an instance of the JVM.
- Byron
_______________________________________________
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
Byron Wright
Software Developer
Siemens Business Services Media
(formerly BBC Technology)
Mobile: 206-227-4645
Email: email@hidden
www.bbctechnology.com
www.siemens.co.uk/sbs
This e-mail (and any attachments) contains confidential information
and is for the exclusive use of the addressee/s. Any views contained
in this e-mail are not the views of Siemens Business Services Media
Holdings Ltd unless specifically stated. If you are not the addressee,
then any distribution, copying or use of this e-mail is prohibited. If
received in error, please advise the sender and delete/destroy it
immediately. We accept no liability for any loss or damage suffered by
any person arising from use of this e-mail/fax. Please note that
Siemens Business Services Media Holdings Ltd monitors e-mails sent or
received. Further communication will signify your consent to this.
Siemens Business Services Media Holdings Ltd
Registered No: 04128934 England
Registered Office: Siemens House, Oldbury, Bracknell, Berkshire, RG12
8FZ
_______________________________________________
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