J2ME and Other Java Platforms

J2ME is intended to be the way ahead for Java on small devices, but, as noted at the beginning of this chapter, there are other Java platforms already in existence (and in use) that have similar scope. The following sections briefly summarize these alternative platforms and compare them to J2ME.

JavaCard

JavaCard is a platform aimed at smart card technology. Smart cards are the smallest environment for which a Java platform exists. The constraints of these devices are such that the JavaCard virtual machine and the small set of Java class libraries that it supports require only around 16 KB of non-volatile memory and 512 bytes of volatile memory. The scope of J2ME does not extend to platforms with this little resource, so there is no J2ME configuration that is suitable for the current generation of smart cards. You can find more information about JavaCard at http://java.sun.com/products/javacard/.

EmbeddedJava

EmbeddedJava is a JDK 1.1-based platform that is used to create software for embedded devices. These devices typically have a 32-bit processor with 512 KB of ROM and 512 KB of RAM available for the VM, class libraries, and embedded application. Since embedded devices generally serve only one purpose, it is unnecessary to include parts of the Java platform that the application does not require. In fact, EmbeddedJava allows the implementor to remove any package or class -- or even a method within a class -- that is not required, in order to fit the final product into the memory available. The EmbeddedJava specification, which can be found at http://java.sun.com/products/embeddedjava/, defines only the maximum possible content of the platform, rather than a minimum (as is the case with J2ME specifications).

EmbeddedJava is currently undergoing its end-of-life cycle, which means that it will no longer be supported as of January 1, 2003. In the future, developers in embedded environments will probably migrate to CDLC and one of its profiles, which are targeted to devices with similar resources.

PersonalJava

PersonalJava is intended for a much more general application environment than EmbeddedJava. The target devices for Personal Java have up to 2 MB of ROM and at least 1 MB of RAM available for the Java platform itself, with more required for application software. Some of the larger PDAs and communicator devices, such as the Compaq iPAQ and the Nokia 9210 cell phone, are currently using the PersonalJava environment.

PersonalJava is based on JDK 1.1.8 and includes a fully featured Java VM. The specification, available at http://java.sun.com/products/personaljava/, designates each of the core JDK 1.1.8 packages as required, modified, or optional. Similar designations may also be applied to individual classes and methods. A required package must contain all of the classes from its JDK 1.1.8 counterpart, and each class must be a full implementation. An optional package may or may not be present, but if it is present, it must be complete. A modified package must be present, but its content may differ from its JDK 1.1.8 equivalent according to rules laid down in the specification. PersonalJava includes user interface components in the form of a modified java.awt package, and it also has optional support for RMI.

PersonalJava developers are expected to use CDC as a migration path to the Java 2 platform. Since PersonalJava includes user interface components, it will be necessary to wait for the Personal Basis and Personal Profiles to become available before migration can be started. PersonalJava applications that use RMI will also need to use the CDC RMI profile.

Get J2ME in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.