Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > How to add Java binaries to a project

How to add Java binaries to a project
Thread Tools
absmiths
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Jan 29, 2004, 05:02 PM
 
I know I can select "Add Framework" to add a jar file to my XCode project, but I can't seem to get it to be included in the build. I can verify that tha jar file shows up in my target under Frameworks & Libraries, but the file is never in my built .app. How can I tell it where to put the file?

On a side note, how do I tell XCode in Cocoa Java Specific how to find the jar files?
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Jan 29, 2004, 05:29 PM
 
I think you need to add a 'copy' build phase if you want it included in your .app bundle. I don't have xcode in front of me right now so I don't remember the exact procedure, but if you look under targets and choose the target you're using, you should be able to add a build phase and specify the jar you want to copy into the bundle.
     
iOliverC
Grizzled Veteran
Join Date: Jun 2002
Status: Offline
Reply With Quote
Jan 29, 2004, 05:41 PM
 
To make a new build phase, highlight the Target icon and in the main menu goto Project -> New Build Phase -> New Copy Files Build Phase.

A panel should come up, in the drop down menu choose frameworks, and close the panel. Now you should see a little item in the outline view for the copy phase, simply drag and drop the .jar file from your project bit above it and build.
     
absmiths  (op)
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Jan 29, 2004, 06:38 PM
 
Thanks for the info. That finally worked, after a LOT of trial and error. I could only add a file to the copy phase if it was already added to the resources for some reason.

But now my app keeps terminiating when I call methods on the java objects - I keep getting signal 10. Any ideas? How does Acquisition stay stable?
     
itai195
Addicted to MacNN
Join Date: May 2001
Location: Cupertino, CA
Status: Offline
Reply With Quote
Jan 29, 2004, 07:11 PM
 
Are your class files and the jar in the same directory within your bundle?
     
absmiths  (op)
Mac Elite
Join Date: Sep 2000
Location: Edmond, OK USA
Status: Offline
Reply With Quote
Jan 29, 2004, 09:30 PM
 
Originally posted by itai195:
Are your class files and the jar in the same directory within your bundle?
Actually, the entire Cocoa application is written in Objective-C, and the Java stuff is in the jar file (in Contents/Resources/Java), built outside of XCode with Ant. Right now, my ObjC code creates an instance of a java class, and calls a method which returns an other java class, and I print the result to the log. I got this message once:

Class whatever$1 does not support the method getPhone, mapping to getPhone()

Which seemed very weird.
( Last edited by absmiths; Jan 29, 2004 at 10:28 PM. )
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 09:33 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,