Sunday, May 14, 2006

J2ME and My RAZR

Last night I figured out how to create Java 'midlet's, small Java-based apps for the J2ME platform for mobile devices.

This wasn't a particularly cunning exercise in tech wizardry; it was more like several hours spent wading through documents and tutorials to see if I could get the whole toolchain to work, to the point where I could see "Hello MIDP" on my phone.

I got 100% of the way there in terms of getting the Hello World midlet to show up on my RAZR; I got the toolchain working about 90%. Here's what I did:

I downloaded Sun's Wireless Toolkit and Motorola's SDK. I already have Eclipse on my computer, along with Java 5. I installed EclipseME, an Eclipse plugin for J2ME development. I got everything working to the point where I can 1) write a J2ME app in Eclipse, 2) compile it there, 3) package it there as a JAD file (the deployable form of a midlet), 4) test it in an emulator on my computer (both a generic cell phone emulator and Motorola's RAZR emulator), and 5) deploy it to my cell phone so that I could run it as a normal Java app.

Only two things missing so far: I had to run the emulator separately from Eclipse. EclipseME is set up to work with Sun's WTK within Eclipse, but I wanted to use Motorola's more specific emulator, and I wasn't able to do that; I kept getting errors to do with the emulator connecting to the Eclipse debugger. Instead, I had to run Moto's emulator separately and switch to it. The other thing is using Midway, Moto's deployment tool (part of the SDK), separately from Eclipse to send the app to my phone. EclipseME doesn't say you can do that, but Eclipse's architecture should allow a way to script that behavior; I just didn't waste time trying to do it.

All of this depends on having unlocked my RAZR to allow direct-cable connections for Java app loading. Normally you have to send your phone in to the service center to get them to unlock it, a five week odyssey, apparently. I found guides and software on the Internet to do it. Motorola's SDK comes with an OTA (over the air) server to allow downloading, I believe (for testing purposes).

If anyone wants more detail, I can get into it, but for now I'm trying to come up with the next mobile killer app so I can retire.

No comments: