02-08-2010 10:48 PM
I have been struggling through using Netbeans for my Blackberry platform project. (I tried eclipse and JDE both -- eclipse is filled with too many little frustrations, and JDE just doens't have the features I'm used to.)
I have pieced together bits and pieces of how to make this work,a nd plan to post a "how to" blog to ease the pain of future Netbeans users. However, one thing I have not been able to track down yet is how to handle localization/resource bundles.
The localization sample projects don't shed much light - they seem to assume that you will be developing in the JDE, which makes localization transparent behind the scenes. From what I can gather, RAPC is generating an interface file that contains const definitions for all of the resources. This is behind the scenes - I can't find this file as an output anywhere.
I am trying to find out specifically how to generate only this interface file for availability in Netbeans -- whether it be the appropriate rapc.exe command line options (which I could include the netbeans ant script) or some other method.
Has anyone had experience with this?
Solved! Go to Solution.
02-09-2010 04:48 AM
you can find the interface in your temp folder. i add an interface to my eclipse project, but don't add it to the jde (as it is auto-generated).
If your resourcefiles are named ABC.rrc/rrh your interface needs to be named ABCResResource.
It has to devince long BUNDLE_ID and String BUNDLE_NAME (values are not important). you can define all your resource keys as int with the value 0.
I usually add the values in my dummy interface first and to the jde resource editor second.
02-09-2010 05:08 PM
Ahh, that may work - so you manually create /maintain the interface file in your project, then just exclude it from build?
02-10-2010 03:26 AM
yes. if you were to ignore the errors of your IDE you could also let the jde generate the file (you can find it in the temp folder) but i usually think it better to just maintain it manually.
02-14-2010 06:30 PM
Thanks for your continued help & suggestions. I'm finding BB to be a great platform, but I do wish that RIM hadn't decided that the JDE or eclipse plugin would be al that anyone wants/needs to develop for their platform. Separating their toolchain into component parts would make this a ton easier - getting a working end-to-end environment under netbeans (and Ant) has been more painful that it needed to be by far.
Anyway - I've been trying intermittently to work through this, and keep running into problems.
When I exclude the manually created interface file (BBSSHResources.java) from precompile and jar phases, the rapc process with verbose output does show that it's processing the RRC/RRH file -- and I can find the temporary .java file in the temp folder -- but it does not add the .class file to the final COD. This results in ClassdefNotFound and similar at run time. Alternatively, if I do include my manual interface, it includes that version directly and does not overwrite it when creating the COD - resulting in invaldi resource ids/names at runtime.
No combination of tricks I've been able to come up with works around this. Frustratingly, I have found several web sites that link to an article at jonathanfisher.co.uk's site -- describing exactly how to do this with Netbeans, but it seems that he has pulled all of his BB-related content. (Alas, google cache and archive.org don't have it either.)
So as far as I can tell, these are my options - in order of ease:
Is there sometihng obvious I'm misisng (hopefully)? It really seems like in a JDE project, the RAPC process parses the RRH/RRC, creates the interface, and includes the .class file in the COD alomst as one step. Perhaps this is because no separate preverify phase is done? (Netbeans does run preverify separately.)
02-14-2010 06:31 PM
Oops - meant to say "BBSSHResource.java" - it's using the correct name, so that's not a cause of any troubles
02-14-2010 07:27 PM
Looks like option 1 was a false trail - I had read that it will generate the java interface file and add it to the project,. Upon running it, that does not seem to be the case - output still goes to the temporary folder only.
02-15-2010 12:56 PM
I followed option 2, and wrote up a tutorial for how I manage it. I suspect there are a couple of things I need to clean up (detailed at the end of the tutorial), but this does resolve the issue.