Ok.  I got it to run from inside Eclipse.  But that's the only place it will work.  Eclipse showed that JavaFoundation was in fact the Main bundle.  When I try to run from outside Eclipse using a jar that I exported or using the Mac App Bundle that Eclipse generates, then it always complains about the Main bundle being null.  How do I make it use JavaFoundation as the main bundle?
 
Thanks,
John
----- Original Message -----
Sent: Monday, January 30, 2006 5:24 PM
Subject: Re: EnterpriseObjects in a regular Java application

That NPE is a result of your Main Bundle being null ... If you're not running inside of a bundle, it falls back to using JavaFoundation as your bundle (this officially explains why when things get funky people end up launching JavaFoundation.woa!).  Double check that JavaFoundation is, in fact, in your classpath.

At the top of your main method, add:

    System.out.println("Main.main: main bundle = " + NSBundle.mainBundle());
    System.out.println("Main.main: JavaFoundation bundle = " + NSBundle.bundleForName("JavaFoundation"));

In my main method, this prints out:
Main.main: main bundle = <com.webobjects.foundation.NSBundle name:'JavaFoundation' bundlePath:'/System/Library/Frameworks/JavaFoundation.framework' packages:'("com.webobjects.foundation", "com.webobjects.foundation.xml")' 212 classes >
Main.main: JavaFoundation bundle = <com.webobjects.foundation.NSBundle name:'JavaFoundation' bundlePath:'/System/Library/Frameworks/JavaFoundation.framework' packages:'("com.webobjects.foundation", "com.webobjects.foundation.xml")' 212 classes >

ms

PS, for eclipse people -- that "Main.main" is a result of a template I have that's really handy.  I call it "sop", and it's defined as
System.out.println("${enclosing_type}.${enclosing_method}: ${cursor}");
So I can type sop<cmd-space> and it will fill in the class and method name of where the cursor is located.  Just spreading the love :)
 
<Thread chopped to keep message size small>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to