JavaBridge tool problem on Panther
JavaBridge tool problem on Panther
- Subject: JavaBridge tool problem on Panther
- From: Ryuichi MIZUNO <email@hidden>
- Date: Fri, 31 Oct 2003 02:10:08 +0900
- Organization: CyberLaboratory
Hi all,
Does anyone know JavaBridge tool and /usr/lib/Java/*.dylib
are still available on Panther ?
in my experience, they don't seem to work well.
for brief testing, I implemented a very simple project.
1. made MyObjC.framework and put it at /Library/Frameworks/
2. made MyObjCWrapper.dylib with bridget
(project itself was ported from 10.2.8 by PBWO,
I just only recompiled it, though)
and put it at /usr/lib/Java/
and put MyObjC.class at /Library/Java/Extensions/jp/cyberlab/MyObjC/
3. wrote simple objective-c class and java class mixing in X-Code.
@interface MyObjC : NSObject {
NSString* _myName;
}
-(void)setMyName:(NSString*)name;
-(NSString*)getMyName;
@end
@implementation MyObjC
... simple set/get methods impl
@end
@interface NSObject(JavaFoo)
-(void)printName;
-(void)printName2:(NSArray*)obj;
-(void)printName3:(MyObjC*)obj;
@end
@interface Tester:NSObject
{
}
-(void)test:(id)sender;
@end
@implementation Tester
-(void)test:(id)sender {
MyObjC* obj = [[MyObjC alloc] init];
id foo = [NSClassFromString(@"Foo") new];
NSArray* array = [NSArray array];
[obj setMyName:@"Ryuichi"];
[foo printName];
[foo printName2:array];
[foo printName3:obj];
}
@end
class Foo {
public Foo(){ super(); }
public printName(){
MyObjC localObjCObj = new MyObjC();
localObjCObj.setMyName("MIZUNO");
System.out.println("** printName() ------ local messaging --------");
System.out.println("desc is " + localObjCObj.toString());
System.out.println("class is " + localObjCObj.getClass());
System.out.println("my name is " + localObjCObj.getMyName());
}
public printName2(NSArray proxyObj){
System.out.println("** printName2() ---- proxy messaging NS class -----");
System.out.println("desc is " + proxyObj.toString());
System.out.println("class is " + proxyObj.getClass());
}
public printName3(MyObjC proxyObj){
System.out.println("** printName3() ---- proxy messaging MY class -----");
System.out.println("desc is " + proxyObj.toString());
System.out.println("class is " + proxyObj.getClass());
System.out.println("my name is " + proxyObj.getMyName()); // ATTENTION !
}
}
now, calling -(void)test:(id)sender, I got a log below:
** printName() ------ local messaging --------
desc is <MyObjC 0xXXXX>@XXXXX;
class is jp.cyberlab.MyObjC.MyObjC // OK !!
my name is MIZUNO
** printName2() ---- proxy messaging NS class -------
desc is <MyObjC 0xXXXX>@XXXXX;
class is com.apple.foundation.NSArray // OK !!
** printName3() ---- proxy messaging MY class -------
desc is <MyObjC 0xXXXX>@XXXXX;
class is com.apple.foundation.NSObject // WHY ????
and this test .app crashed (SIGTRAP)
because malloc error occurred and raised OutOfMemoryException
in the call proxyObj.getMyName()
I guess a communication via proxy between live java object and
objective-c object has a serious problem, at least, as long as using bridget.
on 10.2.8, does NOT work any !!
javaVM complained classNotFoundException com/apple/foundation/NSObject
in ClassLoader.loadClass0()
on MacOSXServer 1.2, very very legacy system, this test project works fine,
though. sigh ...
I think Java Bridge technology is still very useful.
I hope that an urgent fix for bridget and related dylibs would be done
and X-code would support bridget actively on Panther.
OR
if someone knows any way to manage bridge well on Panther,
any suggestions would be gratefully appreciated.
thanks in advance,
----
Ryuichi MIZUNO (CyberLaboratory Inc. Japan)
_______________________________________________
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.