• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: calling Java for ObjC
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: calling Java for ObjC


  • Subject: Re: calling Java for ObjC
  • From: Evan Schoenberg <email@hidden>
  • Date: Wed, 5 Jan 2005 22:32:04 -0600

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


_______________________________________________ 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
  • Follow-Ups:
    • [SOLVED] Re: calling Java for ObjC
      • From: Byron Wright <email@hidden>
References: 
 >calling Java for ObjC (From: Byron Wright <email@hidden>)

  • Prev by Date: Re: IB hierarchy question…
  • Next by Date: [SOLVED] Re: calling Java for ObjC
  • Previous by thread: calling Java for ObjC
  • Next by thread: [SOLVED] Re: calling Java for ObjC
  • Index(es):
    • Date
    • Thread