08 April 2007

In recent posts, I've blogged about my ambition to get a J2ME archetype up and running, and finally, I can present the fruits of my …quest! You thought I was going to say “labor”, eh? The nice part about the world is there are so many other people better positioned to beat me (or you) to the finish line. Case in point: the pyx4me project project has done an incredible job of wrapping Antenna, providing a JSE-based emulator, providing framework classes and of providing a working support for different things and of providing useful examples.

I've taken their examples and orchestrated an archetype for getting started quickly with J2ME. 

Put another way, they've already done the work of getting started with J2ME. It just isn't (to me, a humble J2ME developer with a cause) apparent where to begin. So I made it apparent for my own purposes. Perhaps you'll find it useful, as well.  

To get it up and running, simply issue: 

mvn archetype:create -DarchetypeGroupId=com.codecafe.archetypes \
-DarchetypeArtifactId=j2me-simple \
-DremoteRepositories=http://codecafe.dev-hda.com/repository \
-DarchetypeVersion=1.0-SNAPSHOT -DgroupId=org.example -DartifactId=myapp

On my system, I have three system variables of importance. Here's the pseudocode for their organization: 

WTK_HOME=installation of wireless toolkit ;
JAVA_HOME=installation of java development kit ;
PATH=WTK_HOME/bin;JAVA_HOME/bin ;

So long as all that's setup, you need only cd into your “myapp” directory and issue “mvn clean install” and then double click on the resultant .jad file to open up the emulator and preview your application. 

Please see the Pyx4me project's home page for the overall project,   the antenna project, and, lastly my documentation for information on using the archetype, getting started on an application and coverage of a few common cases I ran into. If you find anything lacking or non intuitive, please drop me a comment and I'll try to address it.