There are three main types of Java platforms that can be made available on Openmoko devices such as the Neo1973.
- Java Standard Edition (Java SE)
- Java Micro Edition (Java ME)
- Hybrid Solutions
Java Standard Edition (Java SE)
This is the incarnation of the desktop version of Sun's Java platform. The majority of its codebase was recently opensourced under the GPL+exception license; the closed bits are quickly being replaced by unencumbered alternatives.
When people talk of Java applications, they're usually referring to software targeted to this platform. Application memory footprints on desktop applications usually include the VM and base libraries, rather than just the application itself (this isn't the case in Java ME).
Java Micro Edition (Java ME)
This is the 'lite' edition of the Java platform. Modular and optimised for embedded devices, this platform provides a much more restricted set of language and library features.
Java ME applications are usually referred to as MIDlets (Sun's name for these applications).
When talking about games and mobile phone games in general, people are normally referring to this platform. Java ME games and applications are expected to function within the strict memory capabilities of the corresponding platform (application descriptors allow the runtime environment to know for which they are intended).
Memory footprints of MIDlets written for Java ME are typically quoted exclusive of the VM or base libraries -- this is because they are often delivered to Java-enabled devices over the network. Footprint sizes average 10-64KB, with recent devices supporting up to 1MB MIDlets.
MIDlet are delivered as two files:
- a .jad MIDlet metadata descriptor
- a .jar MIDlet container, containing executable bytecode and any required resources
Other approaches include mixing and matching Java SE and Java ME in various ways. Standard methods include providing a compatibility layer on top of Java SE (like microemu) to allow it to run Java ME and expanding Java ME to provide more Java SE features.
Another possible approach would be to have every application compiled to native with gcj when installed and then run without a JVM, with a much faster startup. This may be risky and needs a specialized installer.
Java SE implementations
- OpenJDK, the open-sourced implementation of the Java Platform Standard Edition.
- Icedtea, basically OpenJDK with some improvements (initially from Redhat) to ease incorporating into free software distributions.
- Cacao is a GPL Java-Virtual-Machine(JVM) which uses Just-In-Time(JIT) compilation combined either with Icedtea/OpenJDK or Classpath.
- JamVM, another GPL JVM with very small footprint (<160k) combined with Classpath classes.
- Apache Harmony, is the Java SE project of the Apache Software Foundation.
Java ME implementations
- PhoneME is basically the code base of Sun's commercial Java ME implementation without those components that Sun can't --or won't-- release to the open source community. It is licensed under GPL2. There are actually two versions of PhoneME:
- PhoneME Feature: is an implementation of the CLDC (Connected Limited Device Configuration) and MIDP2 (Mobile Information Device Profile) as is common on feature phones (e.g. 'normal', non-smart phones).
- PhoneME Advanced: is an implementation of the more complex CDC (Connected Device Configuration), designed for more advanced handsets.
|NOTE: this runtime and library can be made available for OpenMoko through OpenEmbedded easily.|
- MIDPath is a Java library which provides a MIDP2 implementation and can be used together with the CLDC version of the Cacao to provide an alternative implementation of CLDC/MIDP.
- Microemu: a Java ME emulator that runs on top of Java SE. If the overhead is small enough, it should be the "cheapest" solution.
Status on Openmoko
Java-pkg is a projects.openmoko.org project whose aim it is to "Get Java going on Openmoko, and once it's running, maintain it. There are two subprojects, one for JME and one for JSE. Priority is currently given to JME CDC profile." There is currently a work-in-progress recipe for PhoneME Advanced in their SVN, which doesn't fully build, as well as a working recipe for PhoneME Feature, which only works directly on the Neo1973 framebuffer (e.g. you'll have to stop Xfbdev).
Jalimo is a project to feature the integration of free Java-like implementations for free platforms. They already have packages for Openmoko, covering Cacao, GNU Classpath (with Swing support), PhoneME Advanced Foundation/Personal, SWT and the java-gnome bindings, which allows writing GTK+ applications in Java. Build recipes are part of OpenEmbedded and maintained therein. This article describes, how to get started, if you want to install and use Jalimo on Openmoko based systems.
On Debian, both CacaoVM and JamVM SE-JREs have been ported, and although JamVM is considerably faster at start-up, CacaoVM offers a full JSE-1.5 implementation from Icedtea than JamVM's GNU-Classpath classes. The microemu can be used on top of CacaoVM to run PhoneME applications (MIDlets etc).
Google should be your main resource for most Java-related topics. Below is a selected list of further information resources.
Java SE Links
In 2006/7 Sun acquired the assets of Savaje, which included a port of J2SE to ARM Linux. This was used to build the "JavaFX" modules and, in fact, it runs on the Neo1973 already. They used it to show JavaFX at the JavaOne 2007: http://java.sun.com/javaone/sf/media_shell.jsp?id=193609 See also http://blogs.sun.com/jonathan/entry/when_not_where