Using the BlackBerry Java Plug-in for Eclipse with an existing Eclipse 3.7 installation
I hate it when people artificially limit things. Like rev limiters. What exactly is it with companies and assuming their consumers are so pathetically irresponsible they'd blow things up on their own accord and then do something like try to sue—well, okay, on second thought, I can understand where they're coming from sometimes.
That said, I'm not one of those litigious types of people, and I happen to like using my IDE for developing things, instead of whatever bullshit someone says I need to use. So when I found out the BlackBerry Java “Plug-in” for Eclipse (insert about six registered trademark symbols in there, by the way) actually doesn't work with existing Eclipse installations, I got ridiculously drunk. And then I fixed their crap.
Getting started
The unfortunate reality of this situation is that you still need to download the enormous “Plug-in” so you can manipulate some files. I'd love to just link to a couple of jars you can download, but I think RIM would probably sue me if I did that.
Head over to the BlackBerry Website and grab yourself a copy of their IDE. You'll want to create a developer account on the site as well, as you'll need it for authenticating later in this article.
Go ahead and install the IDE, but don't bother creating shortcuts or anything because it doesn't register itself as a proper Windows application and you're just going to delete the installation anyway. I also ran into this awesome issue where the installer hung while loading itself for about 5 minutes for no apparent reason, so if you experience the same thing you're going to have to muster up some patience and grab a mojito or something. For the purposes of this article, I'm going to assume you installed it to C:\RIMSucksAtEclipse.
Configuring update sites and general Eclipse set up
Interestingly enough, RIM does provide an update site for the individual BlackBerry SDKs that their Eclipse plug-in supports. Fire up your proper copy of Eclipse 3.7 and navigate to Help › Install New Software.... In the Work with text box, put in the update site URL http://www.blackberry.com/go/eclipseUpdate/3.6/java. Select whatever SDKs you need; in my case, I'm going to opt for the 4.7.0.x version.
Check some boxes, son.
Run through the installation process, happily ignoring whatever licenses they might suggest you take a look at, and use your developer account credentials to authenticate when you're prompted. The installation is pretty quick, but the download itself takes some time. While I wait, I like to play this game where every time my download speed drops below 350KB/s I take a shot.
You also need to make sure you have the Eclipse Plug-in Development Environment (PDE) installed; if you don't, you can get it through the usual Indigo update site. And hopefully now you can see what we must do to accomplish our goal!
Importing BlackBerry IDE features and plug-ins
Go to File › Import.... In the dialog, expand the Plug-in Development tree and select Plug-ins and Fragments. Hit Next ›. In the Import From group, select Directory and put in C:\RIMSucksAtEclipse\plugins.
It actually doesn't say “RIM Sucks at Eclipse,” it says, uh, “RIM's ucks ate clips.” The ucks is an endangered lizard that resembles the Android robot. The “e” at the end is a typo.
Next › again. From the Plug-ins and Fragments Found selection box, pick net.rim.ejde, net.rim.ejde.doc, and net.rim.ejde.preprocessing.hook and hit Add -› for each of them.
And finally slap that Finish button. It might take a few times because if you're drinking like I am, you're pretty shitfaced by this point. You should get three new projects added to your workspace, one for each of the plug-ins you picked above.
Now we have to repeat the process for the UI feature. Ready? Head to File › Import... again, and this time in the Plug-in Development tree select Features and hit Next ›. Uncheck Choose from features in the target platform and set the Feature Location to C:\RIMSucksAtEclipse. Select only the net.rim.EclipseJDE feature and, once again, slap Finish.
Eclipse really has some of the most inconsistent and unintuitive interface design I've ever seen.
Congratulations, now you've done something RIM really didn't want you to do.
Fixing net.rim.ejde
Expand the net.rim.ejde project and open plugin.xml. You'll get a fancy PDE editor. Select the Dependencies tab. All of those required plug-in dependencies that appear incompatible with Eclipse 3.7? Yeah, you're going to have to change those. Select the first one, org.eclipse.ui, and click Properties.... Set Maximum Version to 4.0.0 and hit OK. That'll show those suckers.
Repeat the process for everything except org.eclipse.core.filesystem, which doesn't need to be changed, and org.apache.ant, which should have its Maximum Version set to something like 2.0.0. Here's what you'll get when you're done:
Save the file and close it. You're done with that crap. But we do have one more thing to edit in the net.rim.ejde project for proper Java 7 support: their XML Schema for validating configurations is broken! Open schema/BlackBerry_App_Descriptor.xsd. On line 82, change the value attribute of the xs:pattern element to the following string:
($\{)?[a-zA-Z_]{1,63}[\-a-zA-Z_0-9.]{0,63}[\}]?
And on line 89, similarly change the value to the following:
([a-zA-Z_]{1,63}[\s\-a-zA-Z_0-9.]{0,63}[;]?)*
Sweet! We're all done. Go ahead and save and close that file as well; let's move on.
Fixing net.rim.ejde.doc
Next up is net.rim.ejde.doc. Like with net.rim.ejde, open up the project's plugin.xml and go to the Dependencies tab. Luckily we only have a few dependencies to fix here; the same process applies as before. Don't touch the net.rim.ejde dependency. Here's what you should get when you're done:
Save the file and close it.
Fixing net.rim.EclipseJDE
The last bit we need to fix is net.rim.EclipseJDE. Open its feature.xml and click the Dependencies tab. Luckily, someone at Eclipse was thinking when they designed this interface: press the Compute button. You're done.
I'm glad someone working on Eclipse has a clue.
Save the file and close it. Save the file and close it. Save the file and close it. I'm playing another drinking game where I take a shot every time I write the word “save.” Hell yes.
Bundling everything up
Are you excited yet? Huh? Are you? Good. That's what I thought.
Go to File › Export... and in the Plug-in Development tree select Deployable features. Check net.rim.EclipseJDE. For the Directory, you're going to put it straight into your existing Eclipse installation (unless you're not comfortable doing that, in which case you can go an awkward route around it or something... and you're also not drinking enough). Click on Browse... and navigate to your Eclipse 3.7 installation directory. Right click the dropins directory and select New › Folder. Call it net.rim.EclipseJDE. Right click on that directory and create another new directory called eclipse. That'll be your target directory.
So close! I'm getting all tingly inside! Oh wait, that's the rum. Whatever. Close enough.
I want you to fucking punch that Finish button. Just annihilate it. Destroy in every way. If you're curious what it does after it's done, check out the contents of that eclipse directory. If not, just restart the workbench.
Great success!
If everything goes according to plan, when you restart Eclipse you'll get a horrible Web page showing some BlackBerry developer information. You should be able to create a BlackBerry project, too!
Put this in your pipe and smoke it, RIM!
I ran into some warnings regarding the preprocessing hook plug-in, but ignoring them didn't seem to be an issue. Everything still works. And I'm drunk as fuck. Mission accomplished.
Oh, and you can delete C:\RIMSucksAtEclipse now. Delete it hard.
Comments? Critiques? Hate mails? Autograph requests? Send them right here. If you're super lucky I might even publish them.