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 > Cocoa-Java advice

Cocoa-Java advice
Thread Tools
Fresh-Faced Recruit
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jun 5, 2001, 08:59 AM
 
Hi. I know the subject of this thread is going to tempt you to flame me, but please bear with me for a while Basically, I'm developing an application using JDBC, so I have no choice but to use Cocoa-Java. As expected, I ran into problems with the Java bridge at once... So... Could anybody give me advice on how to avoid those dreaded Java bridge errors? Are there any general guidelines I can follow that will (hopefully) keep me out of trouble? For example, I tried to create a class implementing NSTableView.DataModel, but no matter what I do I keep getting NullPointerExceptions!!! Any help, please?

Thank ya!
     
Senior User
Join Date: Nov 2000
Status: Offline
Reply With Quote
Jun 5, 2001, 10:05 AM
 
I haven't used the Java bridge since the Public Beta but last time I checked this still worked (sort of). It shows how to setup the data source for a table. It was kind of thrown together and it hasn't been touched for a while but it may be able to help.

Good luck!
     
Dedicated MacNNer
Join Date: Oct 2000
Location: Pasadena, CA, USA
Status: Offline
Reply With Quote
Jun 5, 2001, 11:38 AM
 
For things like NSTableView.DataSource objects, I recommend making your java classes extend com.apple.cocoa.foundation.NSObject. I've found that the bridge tends to let Java objects get garbage collected unless you do some cocoa-style memory management, which is done automatically for you by NSObject.

Or something like that. It worked for me.

Erik
     
cajun  (op)
Fresh-Faced Recruit
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jun 5, 2001, 12:24 PM
 
Thanx for the replies guys! I looked at IamBob's cool code (it still works!) & found the problem. Turns out that I am not supposed to implement NSTableView.DataSource as a Java interface. Stupid me!
     
   
Thread Tools
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
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:47 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2