Saturday, September 25, 2010

Preparing NetBeans IDE for Java ME on Ubuntu 10.04 (64-bit)

I've posted on installing Netbeans on Ubuntu using the packages available on the NetBeans site before. But when installing something manually instead of through the package manager provided by Ubuntu, there's the problem of maintaining manually installed software yourself.

If you'd prefer not to go through the hassle of manual maintenance, then you can install NetBeans from Ubuntu Software Center. NetBeans 6.8 is currently in Ubuntu 10.04. It's not the latest – 6.9.1 – but it's close enough for out purposes.

First, you'll want to install 32-bit JDK on your system though. Installing the JDK is straightforward on 32-bit Ubuntu – just use Ubuntu Software Center – but you'll unfortunately still need to manually install it on 64-bit Ubuntu. Fortunately, there's tools provided to simplify part of the process.

You'll also need to download the Sun Wireless Toolkit for Linux and manually install that too.

So once you have NetBeans, 32-bit JDK and the WTK installed you need to proceed with configuring NetBeans for Java ME development

NetBeans IDE plugins window

In NetBeans head over to Tools->Plugins and install Mobility and Java Web Applications plugins. For some reason I can't figure out, the simulator needs to run through a server although the WTK-provided ktoolbar didn't seem to need one. Of course, it's probably built-in and isn't mentioned anywhere. Be sure to restart NetBeans IDE after installation completes.

Server configuration

Next head to Tools->Server and add a new server to NetBeans. It's not as hard as it sounds since everything is wizard driven and you can basically use all default settings provided. I simply chose GlassFishv3 as the server to install and left all options at their defaults.

Java Platform manager window

In Tools->Java Platform you can add the WTK platform you installed. Just point the wizard to the folder where you have WTK. Again, it's a simple task thanks to the user friendly wizard.

Creating a new Java ME project

Once that's all done, you're ready to go.

Start a new project choosing Mobile Application under the Java ME category. A default Hello MIDlet project is available and makes a good demo for testing that NetBeans is ready for JavaME development.

Hello MIDlet application

There should be basically nothing to maintain manually other than the 32-bit JDK for 64-bit Ubuntu users. Even then I doubt it. After upgrading to Maverick Meerkat during Beta, I found you do need to reinstall the Mobility and Java Web Applications plugins. Seems to be a migration thing from NetBeans 6.8 (Lucid) to 6.9 (Maverick). Other than that everything's fine.

Related posts:

Preparing 64-bit Ubuntu for J2ME development
NetBeans IDE on Ubuntu for J2ME