🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.mac.programmer.codewarrior
Article #846

Re: Cocoa - Java App using Codewarrior 8 ?

#846
From: Brian Hannan
Date: Mon, 10 Mar 2003 23:56
119 lines
6480 bytes
I too want to use CW for Cocoa Java development.  I have a bunch of
existing code in Java but don't wish to proxy it in Objective-C or
learn another SmallTalk variant.  Or use ProjectBuilder.  Essentially,
I want to develop a non-Swing GUI for MacOS X to make it more MacOS X
sexy.

So I played around with ProjectBuilder to see what I could get. 
Basically, I can develop and build in CodeWarrior, but use
ProjectBuilder to package and debug the Coca side.

Here's an overview of what I got to work.  All this assumes CW Pro
8.3, ProjectBuilder 2.1 December 2002 Dev Tools, MacOS 10.2.3 and JDK
1.4 Preview Release 10.

What I do is develop in CodeWarrior and include the classes in
/System/Library/Java in my CW project (but prevent those classes from
being merged into the target JAR I build).

In ProjectBuilder, I make a Cocoa Java project, remove all Java code
and import my CW produced JAR into the project.  Then I added an extra
build phase to to copy the JAR I produced with CW into the Java
resources, and remove the JAR produced by ProjectBuilder.

That works for me.  I develop and build in CW.   When I want to bundle
the MacOS X app I build in Project Builder.  If I point Project
Builder at my source files dir, I can also debug the Coca app as well
from Project Builder.  I'm sure there's a way to get the debug side to
work from CW, just using a Pure Java solution and calling
NSApplication correctly, but I didn't figure that out yet.

Actually, you could skip Project Builder.  Essentially it produces a
small binary from the Objective-C stub in the main.m you'll see in
your Cocoa Java project.  I can take this produced binary from one
MacOS X app package and use it with another jar and set of resoruces I
produce.  So it shouldn't be hard to write a Perl or Shell script to
do the packaging without ProjectBuilder, and have that script called
from CodeWarrior.

Anyways, hope this helps.  If you think this is all too confusing then
perhaps use ProjectBuilder.  However, once you set this all up, it's
easy to do for any number of Java Cocoa apps you have, and easy to
run.  And if you really love the CW dev tools like I do, then being to
use those alone will save you time over using ProjectBuilder.

Cheers.

Isaac Wankerl <spam@metrowerks.com> wrote in message news:<spam-0B3424.13125410032003@news.mtwk.sps.mot.com>...
> In article <FMN8a.105075$P1.6643673@news1.east.cox.net>,
>  "asim barakzai" <asimwork@aol.com> wrote:
> 
> > Ron:
> > 
> > Thanks for you response, but I am not sure how to proceed with this
> > information. I have about 400 Info.plist files on my computer and am not
> > sure which one are you referring to.
> 
> This will be the Info.plist that is inside your application's bundle.  
> If you based your app from the Objective C stationery, then there is a 
> SimpleHello.plc file which generates the Info.plist file.  Open up this 
> .plc file and add these keys
> 
>       key "NSJavaNeeded" value string "YES"
>       key "NSJavaRoot" value string "Contents/Resources/Java"
>       key "NSJavaPath" value array
>       [
>          string __OUTPUT_FILENAME__ ".jar"
>       ]
> 
> I don't know much about Java so there may be additional items involved 
> such as how to generate the .jar file.  You may need a separate target 
> to build it and place it into the
> Contents/Resources/Java folder of your bundled app.
> 
> > Anyhow, when I open up CodeWarrior and do a "New" - Project, then select
> > "Mac OSX Cocoa Stationary" , the only option I get is "Objective-C
> > Application".  I don't get any "Java Application" option here. Am I missing
> > something in my installation of CodeWarrior 8.3 Mac/Win ? Also, the only
> > Cocoa code samples I found on my CodeWarrior installation are in
> > Objective-C.
> > 
> > Additionally, if on the other hand I select the "Java J2SE Stationary ->
> > Java Application" (from "New" Project) I am given a trivial app and see no
> > way to get to Interface Builder from here.
> > 
> > Can you please tell me in simple steps on how to go about creating a Cocoa -
> > Java application with CodeWarrior that uses Interface Builder etc. Or point
> > me to any document on Metrowerks website/CD that outlines this process.
> > 
> > Asim
> > 
> > "MW Ron" <mwron@metrowerks.com> wrote in message
> > news:mwron-2A1C36.10290528022003@enews.newsguy.com...
> > > In article <G2v7a.79307$P1.5213726@news1.east.cox.net>,
> > >  "asim barakzai" <asimwork@aol.com> wrote:
> > >
> > > >I would like to create a Cocoa-Java application using CodeWarrior 8
>  Mac/Win
> > > >but can't seem to find any documentation on how to do this.
> > > >
> > > >Is this even supported ? Or should I just stick with ProjectBuilder ?
> > > >
> > > One of our engineers said, you may just need to add a few extra keys to
> > > the Info.plist:
> > >
> > > NSJavaNeeded  string  YES
> > > NSJavaRoot    string  Contents/Resources/Java
> > > NSJavaPath    array
> > >  item 0       string  CocoaJavaApp.jar "this is based on the executable
> > > file name"
> > >
> > > Ron
> > >
> > > --
> > >        Migrate your PowerPlant Applications to Windows
> > >     http://www.metrowerks.com/MW/Services/OEM/default.htm
> > >
> > > Ron Liechty - MWRon@metrowerks.com - http://www.metrowerks.com
> > 
> >
Technical Details
Message-ID: <3ef5816a.0303101556.791b372b@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
References: <G2v7a.79307$P1.5213726@news1.east.cox.net> <mwron-2A1C36.10290528022003@enews.newsguy.com> <FMN8a.105075$P1.6643673@news1.east.cox.net> <spam-0B3424.13125410032003@news.mtwk.sps.mot.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10bcce,2e46eb92449dcfb4
X-Google-Attributes: gid10bcce,public
X-Google-Thread: f635e,1c283d435cf969e1
X-Google-Attributes: gidf635e,public
X-Google-ArrivalTime: 2003-03-10 15:56:40 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: bhannan@mac.com (Brian Hannan)
Newsgroups: comp.sys.mac.programmer.codewarrior,codewarrior.mac
Subject: Re: Cocoa - Java App using Codewarrior 8 ?
Date: 10 Mar 2003 15:56:39 -0800
Organization: http://groups.google.com/
Lines: 119
Message-ID: <3ef5816a.0303101556.791b372b@posting.google.com>
References: <G2v7a.79307$P1.5213726@news1.east.cox.net> <mwron-2A1C36.10290528022003@enews.newsguy.com> <FMN8a.105075$P1.6643673@news1.east.cox.net> <spam-0B3424.13125410032003@news.mtwk.sps.mot.com>
NNTP-Posting-Host: 209.249.241.4
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1047340599 14078 127.0.0.1 (10 Mar 2003 23:56:39 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 10 Mar 2003 23:56:39 GMT