View source for Java

From Openmoko

Jump to: navigation, search

You do not have permission to edit this page, for the following reasons:

  • The action you have requested is limited to users in the group: Administrators.
  • You must confirm your email address before editing pages. Please set and validate your email address through your user preferences.

You can view and copy the source of this page:

Template used on this page:

Return to Java.

Personal tools


There are two main types of Java platforms that can be made available on OpenMoko devices such as the Neo1973.

  • Java Standard Edition (J2SE)
  • Java Micro Edition (J2ME)
  • Hybrid Solutions

Java Standard Edition (J2SE)

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 targetted to this platform. Application memory footprints on desktop applications usually include the VM and base libraries into account, rather than just the application itself (this isn't the case in J2ME).

Java Micro Edition (J2ME)

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.

J2ME 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. J2ME 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 J2ME 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

Hybrid Solutions

Other approaches include mixing and matching J2SE and J2ME in various ways. Standard methods include providing a compatibility layer on top of J2SE (like microemu) to allow it to run J2ME and expanding J2ME to provide more J2SE 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.


J2SE implementations

  • Cacao is a Java Virtual Machine (JVM) which uses Just-In-Time (JIT) compilation to execute Java methods natively.
  • JamVM is a JVM with a very small footprint (<160k).

J2ME 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.
  • 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.

Status on OpenMoko

Java-pkg is a project whose aim it is to "Get Java going on OpenMoko, and once it's running, maintain it. There are two sub-projects, 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 for free platforms. They already have packages for Openmoko 2007.2, covering cacao, gnu classpath (with swing support) and the java-gnome bindings, which allow writing openmoko GTK applications in Java.


VM Licensing

MIDlet Licensing


Google should be your first port of call for most things Java as it would be impossible to give a comprehensive list of all the useful information out there. That being said, below is a selected list of further information resources.

J2SE 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: See also

J2ME Links