Wireless Java development from the command line
Pressing this a bit harder, because I don’t think it gets enough airtime: wireless Java development can effectively be done and enjoyed from the Unix command line. There is no need to get sucked into an IDE if you naturally prefer otherwise.
- Install Apache Ant and the Antenna wireless task extensions to Ant.
- Get an Ant build.xml that uses the Antenna extensions. Here’s an example from PhoneGnome Mobile: build.xml. And here is the backing build.properties.
- Build with the intention of running off a jar in your filesystem: ant local
- Run in the local emulator: $EMU_HOME/bin/emulator -Xdescriptor build/pg.jad
where EMU_HOME points to whereever you installed your Sun Wireless Toolkit and where pg.jad is whatever your JAD file should be.
When you are ready to deploy, do
ant
noting how the implicit ‘build’ and ‘local’ targets differ in the resulting jad file MIDlet-Jar-URL. To run via over the air provisioning, copy the jad file to whereever you will host it, and do
emulator -Xjam:install=http://www.petrovic.org/j2me/pg.jad
to install the app into the emulator app database. Then
emulator -Xjam
to run the app, and potentially every other installed app, from the emulator’s application management system.
The install into the emulator’s application database can be reversed with, at the very least, a remove-all:
emulator -Xjam:remove=all
See the emulator docs to selectively remove an app.
[tags]wireless java, j2me, jme[/tags]