J2ME Development: NetBeans 6.7M2 vs. Eclipse MTJ 0.91

J2ME development is fun stuff I think. For some reason it is cool to deploy your own apps to a cellphone or a smartphone. Add in a thrill factor based on the real potential of trashing your link to the world and once you get started you won’t want to stop. I recently wiped my laptop’s hard drive and am back to a clean OS. What better time could there be to look at NetBeans and Eclipse as J2ME platforms and figure out which way to go.

Disclaimer: So if you read my blog regularly you will know I’m an Eclipse guy. So can I be fair? Probably not, but I will try to be.

The Challenge: I’m running on win XP Pro on a T61p Lenovo laptop. I have some existing NetBeans apps and I have some J2ME based apps that are targeted at Nokia and RIM phones. I’ll compare easy of installation, configuration, project importing, project creation and the build/deploy process.

NetBeans 6.7 M2

NetBeans has been around for a while as one of the main competitors to Eclipse in the Java development world – IDEA’s IntelliJ being the other one (my personal favorite as well). Getting started with NetBeans is pretty easy. I’ve started myself off with a clean install of a few tools before attempting to install the product.

First off for any J2ME work it is a good idea to get your own JDK. I grabbed JDK 1.6.0 U12 from Sun’s site and installed that to c:. I also grabbed JDK 1.5.0 U17 because many cellphone SDKs still use this one.  I also installed that to the C drive root. I do a lot of bluetooth work so having an install of the Java Wireless Toolkit is a must. Get it here and install it to your hard drive.  Bluetooth is fun stuff, although it can be a bit frustrating…check these two articles if you are interested in learning:

  • http://developers.sun.com/mobility/midp/articles/bluetooth1/
  • http://developers.sun.com/mobility/midp/articles/bluetooth2/

Great stuff…but I’m off on a tangent – back to NetBeans.

Grab the installer  – I grabbed the version wit J2ME integrated, although it is annoying that you also ahve to j2me-2download all the glassfish crap. Why would I want that if I’m doing mobile development? Ah well – when the installer starts up you can unselect that crap by clicking the customize button and unchecking what you do not want. That’s pretty good. An alternative method is to get a bare-bones installer and as with Eclipse you can add the correct plugins – I tried that but could not come up with the magic combination of plugins so I fell back to this method.

Once the install is complete I found it a bit difficult to get a project created. For some reason things did not seem to be installed. On the welcome screen there were some links to example projects. I picked one of those off and sure it enough I got a pop-up about “activating features”. My sample got loaded up properly and then everything seemed to be working.I would suggest that you do the same thing.

After that you will need to (or want to) get the SDKs installed and registered with NetBeans. This is pretty simple. I’m going to be working with Nokia Series 40 phones. I grabbed the SDK from their site and installed it. To add the SDK into NetBeans click on Tools and then Java Platforms. Click the Add Platform button. Then select Java ME MIDP Platform Emulator and hit the next button. NetBeans will scan around for SDKs. When I originally tried NetBeans I was using version 6.5, however when I was trying this, hitting next did nothing. No clue why. I tried this whole routine j2me-3on my main workstation and no problems, but no dice on my laptop. Version 6.7 M2 does work so on I go. Anyway pickoff the platforms that you want, you should see the wireless toolkit and any other SDKs that you have – in my case the Series 40 Nokia.

When you are done you should be dumped back out at the original platform screen , but now you will have some J2ME platforms listed. At this point you are ready to build or import projects.

The NetBeans interface is a decent one – although I don’t like the icons and how they are laid out in various little toolbars all over the place. Many of the icons just seem silly too – like the icon for shifting a line…isn’t that a “tab”? Do I really need an icon? I’d rather have an extra line of code on the screen. Anyway – that’s probably my preference…the interface is snappy. Screen refreshes j2me-6are fast and menus popup right away.

The project structure is obvious and the Navigator is also handy. The output window for builds is odd with many messages that seem strange to me with lots of pre-init, csc-init, etc. messages that I have no clue what they mean. I have not figured out how to get rid of these so that I can just focus on coding messages.

When you build cell phone apps managing configurations is really important. You need to manage different graphics, forms, widgets, etc. so that your UI and perhaps even your functionality is tuned to the capabilities of the phone. NetBeans supports this with Build Configurations . Its pretty simple to add configurations and they work well. You add a configuration and then you can pick off which one is the current active one for builds. Great stuff…but how do you edit them or create your own?

Hmm…well for that matter how do you build a platform? Hmm…this exposes a major issue with NetBeans; Where’s the documentation? There really isn’t any. There’s some tutorials and things on the NetBeans site and the internet, but formal docs are almost non-existent. To make things worse the size of the user base is an issue with getting help in on-line forums and community stuff.

Eclipse 3.4 and Mobile Tools for Java

Mobile development with Eclipse will be fairly straight forward if you are already familiar with using other development perspectives in Eclipse.  In fact this is really the main benefit of Eclipse. To start off you need to add the Eclipse ME update site to your config and install the plugin.

I like to keep my mobile projects separate from non-mobile projects. You can do this in two ways – I’m still on the fence about which is better:

  1. Create a new workspace specifically for mobile apps
  2. Create a new eclipse installation and use that for your mobile projects.

This time around I’m using the first approach. Once you have the base tools installed you’ll see new options for creating midlet projects and cldc projects, but really the next step is to get SDK from some phone vendors. As with NetBeans I grabbed a Nokia kit for series 60 phones and I’ve also grabbed the RIM eclipse plugin from http://www.blackberry.com/developer – my personal favorite phone development platform.

Once you get things installed you can create projects easily. First switch to the JavaME perspective or the perspective for your SDK. Once eclipse_mtj2that is done you can then do the regular “eclipse” thing with the “File->New->Project wizard. You’ll see the options for  MIDLet projects.

You’ll notice also here is where I can pick off a specific phones configuration or SDK for my project. Once a project is created there are differences in how you move forward. With Nokia SDKs you can add one of more midlets to the project and work with the project overview screen for how to package and deploy the applications to either an emulator or to an actual phone.

The RIM SDK is fairly similar to Nokia – just different enough to be annoying. For example each Nokia project has a nice overview screen that shows all the current properties, but rim uses the eclipse standard properties dialog available by right clikcing on the project in the Package Explorer.

In general tho it is a simple matter of reading the docs for the SDKs and you can quickly make headway. The same goes for general documentation on the MTJ tools themselves. For getting started this is a huge difference over NetBeans. The docs are good from both the MTJ project and all the documentation from the phone manufacturers themselves. Perhaps this is ananomaly with RIM and Nokia that they have great docs and other brands do not, but for me this is a big difference over NetBeans.

Once your projects are started you can get all the regular Eclipse style editors, configurators, and run/debug dialogs. Here’s a screen shot eclipse_mtj3from a RIM project and you’ll see that things look pretty familiar. Launching an emulator to run your project is fairly simple. With the Nokia SDK simply add one or more midlet’s and select the one you want to launch from the project’s Overview page. With the RIM SDK you need to activate the project by right clicking on it and then with teh same menu you can select “run as” and the emulator you want. You can get many different emulators from the RIM site.

Conclusion

So which to use? For me the ultimate decider might be to first look at what phones you want to use and see what the brand provides. If you’ve got a choice and are new to mobile development I think Eclipse Mobile Tools for Java is a better choice. More brands are focused on it, the documentation is dramatically better, the community is larger, and most Java developers will be familiar with the IDE straight off.  Pick a pun: “NetBeans is being eclipsed by MTJ” or “the Sun is setting on NetBeans”…ha ha…but I think its probably true.

4 Comments

  1. Eric Hildum

    J2ME developers wishing to get set up fast may find it a bit more convenient to download MOTODEV Studio for Java ME from the Motorola Developer web site (http://developer.motorola.com/). This is a single download preconfigured to contain Eclipse, Mobile Tools for Java (incorrectly listed as Eclipse ME above), the Motorola SDK, and a number of sample applications.

    Eric – Motorola

    Reply
  2. Jason OKeefe

    Great post, thanks! A new addition to mobile dev in Eclipse is the WebKit for SWT (ver. 0.5). It’s an embeddable Java™ WebKit browser component developed by Genuitec. This component can be used in the development of a wide range of Java SWT applications that require integration of rich HTML5, CSS3, JavaScript and Flash content and functionality.

    The immediate consequence of this release is the ability to embed standards-based Web functionality into both desktop and mobile apps with ease, or create friendly hybrid applications that incorporate native and Web elements.

    Thanks, just wanted to share that. The free download can be found here: http://genuitec.com/about/labs.html

    Jason – Genuitec

    Reply
  3. Beren (Post author)

    Eric – Yeah – I mentioned Motodev for Motorola phones. Its a decent product. Thanks for the comment,

    Jason – hey thanks – I’ll have to check that out. sounds cool.

    Reply
  4. Pingback: 2010 at the Lake « Tarn Aeluin

Leave a Reply