Preparing 64-bit Ubuntu for J2ME Development
J2ME development on a 64-bit OS is unfortunately not as programmer friendly as it should be right now. Sun's Wireless Toolkit for CLDC currently only supports 32-bit development, so we're stuck trying to get 32-bit JDK up on a 64-bit Ubuntu.
The good news is there's a Ubuntu package to help us along the way; or at least part of the way. From Ubuntu's package archives, we'll need to install java-package, then proceed with installing the JDK which we'll need to download ourselves from Sun's website.
~$ sudo apt-get install java-package
~$ DEB_BUILD_GNU_TYPE=i486-linux-gnu DEB_BUILD_ARCH=i386 fakeroot make-jpkg
jdk-6u14-linux-i586.bin
~$ sudo dpkg -i sun-j2sdk1.6_1.6.0+update14_amd64.deb
The recommended IDE for J2ME development seems to be either Eclipse IDE or NetBeans, but I prefer a more minimalist approach so I'm using vim. It's not an easy editor to learn, though. There's plenty of resources online on how to setup Eclipse or NetBeans so I'll not delve into them here.
Next up would be to prepare Sun's Wireless Toolkit for CLDC (WTK). The current version is 3.0 but that seems to come bundled with J2ME 3.0 which means it's Windows-only (for now), so we'll be using 2.5.2 for our purposes.
~$ sudo chmod +x sun_java_wireless_toolkit-2_5_2-linux.bin
~$ ./sun_java_wireless_toolkit-2_5_2-linux.bin
Follow the installer's instructions. I chose to install into a folder in my Home folder. I've never liked contaminating my OS with unofficial/unsupported software, so I try to avoid installing anything into the system as much as possible. Over the years, I've come to appreciate the value of less. WTK runs perfectly fine wherever you place it, so there's no worries there. Afterwards, I
simply write a simple script to launch the toolkit for me so I don't have to open up a terminal for it everytime I need it. Just fire up vim and type the following:
#!/bin/sh
~/WTK2.5.2/bin/ktoolbar
I saved it as 'ktoolbar' then made it executable like so:
~$ sudo chmod +x ktoolbar
Double click to run it. Now you're ready to make some midlets. Nokia has a nice and short webinar that you can also download as a pdf for offline consumption. At the time of this writing, I've only just completed up to the sample first midlet myself and I find the webinar to be quite clear and easy to follow.
Resources:
- 32-bit JDK on a 64-bit Ubuntu System
- Java SE Development Kit
- Sun Java Wireless Toolkit 2.5.2 for CLDC
- Java ME for Nokia Platforms E-learning
