[[!meta title="Java Micro Edition"]] Many cell phones and similar devices run a constrained version of the Java Virtual Machine (JVM) called the Sun Java Wireless Toolkit CLDC , Java 2 Micro Edition, or something similar (Sun/Oracle seem to like changing package names). If you want to write a MIDlet that runs on your phone, take a look at Vikram Goyal's detailed [tutorial][VG] (note: Windows-based commands, but they translate easily into Linux equivalents). After installing a J2ME SDK (see below) I worked through the examples in Vikram's tutorial and those in a [post by Hexist][Hexist], to compile a simple app. Here's the source for the app with a cleaned up `Makefile`: * [[Makefile]] * [[HelloWorld.java]] * [[Manifest]] * [[!ltio icon.png]] It's a bit annoying getting a J2ME SDK set up on Linux, because the [Java Wireless Toolkit][WTK] requires the old and buggy Java 1.5. On my Gentoo box, I had to mask version of the JDK greater than 1.5 by creating `/etc/portage/package.mask/java_wtk` containing the line >=virtual/jdk-1.6 The Gentoo Portage tree no longer carries Java 1.5 ebuilds, so I installed the Java overlay # layman -a java-overlay I then started trying to emerge the JDK with calls to # emerge -av virtual/jdk In order for that to succeed I had to: * Create `/etc/portage/package.keywords/java_wtk` containing `dev-java/sun-jdk ~x86` to unmask the JDK. * Create `/etc/portage/package.use/java_wtk` containing `dev-java/sun-jdk -doc` to avoid a fetch restriction on the documentation. * Add `ACCEPT_LICENSE="dlj-1.1"` to `/etc/make.conf` to accept Sun's license for Java 1.5. Take a look at the [Gentoo Java Guide][GJG] page for general information on running Java on Gentoo. Once I got the JDK installed, I installed the [Wireless Toolkit][WTK] in `~/lib/WTK2.5.2` using $ equery files sun-jdk | grep /bin/javac to identify `/opt/sun-jdk-1.5.0.22/` as the Java SDK path. Anyhow, after getting all that setup, I learned that my [Verizon-provided Casio C721][C721] is running the ancient [BREW][] OS 3.x (Chris Wright's [history of mobile games][history] says that BREW went commercial in 2002, but doesn't list specific version release dates). To top that off, they charge [$400 for a developer signature][sig] needed to install apps on *your own phone*. There is an outside chance that they are getting their act together though, with vague press releases about [upgrading][] to [Brew MP][] and [lowering the barrier to entry for app-delivery][open]. I'm skeptical, but I suppose time will tell. [VG]: http://today.java.net/pub/a/today/2005/02/09/j2me1.html [Hexist]: http://hexist.com/?p=29 [GJG]: http://www.gentoo.org/doc/en/java.xml [WTK]: http://www.oracle.com/technetwork/java/download-135801.html [C721]: http://developer.verizon.com/jsps/devCenters/DeviceDB/Landing_Pages/BewCasioExilim.jsp [BREW]: http://en.wikipedia.org/wiki/Binary_Runtime_Environment_for_Wireless [history]: http://www.pocketgamer.biz/r/PG.Biz/A+Brief+History+of+Mobile+Games/feature.asp?c=10618 [sig]: http://en.wikipedia.org/wiki/Binary_Runtime_Environment_for_Wireless#Development_fees [upgrading]: http://www.brewmp.com/showcase/verizon-wireless [Brew MP]: http://www.brewmp.com/ [open]: http://news.vzw.com/news/2010/07/pr2010-06-29.html [WAP]: http://en.wikipedia.org/wiki/Wireless_Application_Protocol [[!tag tags/java]] [[!tag tags/linux]] [[!tag tags/programming]]