Cocoa-Java frameworks
Cocoa-Java frameworks
- Subject: Cocoa-Java frameworks
- From: Chris Bracken <email@hidden>
- Date: Tue, 25 Mar 2003 22:11:34 -0800
Hello,
I've searched all over the place to find an answer to this seemingly
simple question, but so far nothing. What I'd like to do is create a
framework written entirely in Java, then use it from a Cocoa Java app.
I had no problem writing or building the framework, and looking at the
structure of the built framework, it looks correct. The jar file in
the Resources/Java directory contains the correct classes and structure.
Where the problem happens is when I try to use that framework from
another Cocoa-Java app. I added a reference to the framework to the
project just as I would with an Objective-C application, but whenever I
attempt to create objects whose classes are defined in the framework, I
get the following output in the console:
--
Picked up _JAVA_OPTIONS: -Xdebug -Xnoagent -Djava.compiler=NONE
-Xrunjdwp:transport=dt_local,server=y,address=8005
ObjCJava WARNING:
jobjc_jvm_newObject(): constructor with signature ()V on class
MainWinController failed (should morph the java exception)
2003-03-25 21:52:35.768 TestApp[13099] AppKitJava: uncaught exception
OBJCJava_RUNTIME_EXCEPTION ((null))
2003-03-25 21:52:35.768 TestApp[13099] AppKitJava: exception = (null
description)
2003-03-25 21:52:35.768 TestApp[13099] AppKitJava: terminating.
--
The compile, on the other hand, goes fine. Out of curiosity, I tried
the following code. Class names have been altered to protect the
innocent :)
try {
Class.forName("com.blahblah.mypackage.MyClass");
} catch (Exception ex) {
ex.printStackTrace();
}
This causes a ClassNotFoundException. So it appears that the jar file
in the framework is not in the classpath. I did try manually adding
the jar files in the frameworks to the NSJavaPath variable, and the
classes were found... however,
NSBundle.bundleWithIdentifier("com.blahblah.MyFramework") always
returns null. Interestingly the array returned by
NSBundle.allFrameworks() does not contain my framework.
I tried manually loading my framework with
NSBundle.load("com.blahblah.MyFramework"), but again, the classes in
the jar file were not available (unless the jar file was manually added
to NSJavaPath). It seems like there should be a simple,
straightforward way of doing this.
I've written several commercial Cocoa frameworks and applications, but
all were in Objective-C. I'm completely at a loss here, and I suspect
the answer to this will probably be pretty embarrassing... Any thoughts?
Chris
_______________________________________________
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.