Download Java on MIDs

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Programming of Handheld and Mobile
Lecture 10 Java for MIDs
Rob Pooley [email protected]
Programming Handheld and
Mobile devices
Java 2 Platform, Micro Edition (J2ME)
• The Java 2 Platform, Micro Edition (J2ME) provides a
flexible environment for applications running on
consumer devices, such as mobile phones, PDAs, and
TV set-top boxes, as well as a broad range of embedded
• J2ME includes Java virtual machines and a set of
standard Java APIs
• It includes flexible user interfaces, a robust security
model, a broad range of built-in network protocols, and
extensive support for networked and offline applications
Programming Handheld and
Mobile devices
The J2ME Architecture
• The J2ME architecture comprises a variety of
configurations, profiles, and optional packages that
implementers and developers can choose from
Programming Handheld and
Mobile devices
J2ME Configurations and Profiles
Even within J2ME one size does not fit all
Configurations: Minimum libraries and JVM
Profiles: libraries for specific devices or markets
J2ME configurations
• J2ME profiles
– Foundation, Bluetooth, Personal, ...
• Configurations and profiles defined by the Java
Community ProcessSM
Programming Handheld and
Mobile devices
Configurations comprise
– a virtual machine
– a minimal set of class libraries.
They provide the base functionality for a particular
range of devices that share similar characteristics, such
as network connectivity and memory footprint.
Currently, there are two J2ME configurations:
– the Connected Limited Device Configuration (CLDC)
• Established and widely used
– the Connected Device Configuration (CDC)
• Next generation configuration
Programming Handheld and
Mobile devices
• To provide a complete runtime environment for a specific
device category a configuration must be combined with a
• This is a set of higher-level APIs that further define the
application life-cycle model, the user interface, and
access to device-specific properties.
• A profile supports a narrower category of devices within
the framework of a chosen configuration.
• A widely adopted example is to combine CLDC with the
Mobile Information Device Profile (MIDP) to provide a
complete Java application environment for cell phones
and other devices with similar capabilities
Programming Handheld and
Mobile devices
Optional Packages
• The J2ME platform can be extended by adding
various optional packages to a technology stack
that includes either CLDC or CDC and an
associated profile.
• Optional packages offer standard APIs for using
both existing and emerging technologies such
as database connectivity, wireless messaging,
multimedia, Bluetooth, and web services.
• Because optional packages are modular,
developers can avoid carrying the overhead of
unnecessary functionality by including only the
packages an application actually needs.
Programming Handheld and
Mobile devices
Programming Handheld and
Mobile devices
Mobile Information Device Profile
• The first J2ME profile
• Targets devices implementing CLDC
• Profile addresses:
– Display toolkit, user input methods
– Persistent data storage
– Messaging( SMS, email, etc), security and networking
over wireless network connection
Programming Handheld and
Mobile devices
Related Technologies:
Java Card™ Technology
• Specifies minimized subset of
Java technology for GSM SIM
cards, smart cards, Java rings,
and other extremely constrained
Key benefits versus non-Java
smart cards
– Multiple applications per card
– Post-issuance updates to
apps on card
Programming Handheld and
Mobile devices
Related Technologies:
EmbeddedJava™ Technology
EmbeddedJava. technology is a program from Sun
supporting development of dedicated-function
embedded devices for a wide range of end uses
EmbeddedJava technology gives device manufacturers
the ability to:
– Configure the Java platform to leave out unneeded
classes and VM features
– Minimize resource requirements and cost for a
deeply-embedded device
– Optimize for devices with no GUI and intermittent
(at best) networking
– Keep APIs for their devices private
Programming Handheld and
Mobile devices
J2ME™: Connected Device Configuration
• Connected Device Configuration (CDC)
– Targeted for devices that have 2 MB or more total
available memory
– Memory dedicated to J2ME environment
– More than 2MB ROM/Flash
– More than 512 KB RAM
– Network connectivity
– Full Java 2 Virtual Machine specification
Programming Handheld and
Mobile devices
Example J2ME™ CDC Uses
Wireless communicators
High-end PDAs
TV set-top boxes
Automotive entertainment and navigation systems
Telecomm/Networking Equipment
Industrial Controllers
Programming Handheld and
Mobile devices
What Is CVM?
• Basis for J2ME CDC and profiles
– Large VMs for desktops/servers don.t scale well to
– Static and dynamic memory footprint too big
– Not embeddable, ROMable, not portable
– Implicit assumption of virtual memory
– Native stack use, address range reservation
– Implicit assumption of process model
• Global variables, .system threads.
Programming Handheld and
Mobile devices
CVM features
Good JVM features
Device friendliness.
Easily re-targetable
Narrow porting interface
Almost entirely in C (except
dynamic compiler)
• ~256KB with JNI, reflection,
• CVM supports all Java 2 Platform,
version 1.3,
• VM features and libraries for
security, weak references, JNI, RMI
• CVM allows devices to map Java
threads directly to native threads.
• Can run Java classes out of ROM
• Contains a precise memory system
with advanced Garbage Collection
• Small average GC pause times
• Pluggable Garbage Collectors
• Full separation of VM from memory
Programming Handheld and
Mobile devices
J2ME Profiles
• Mobile Information Device Profile (MIDP)
– Profile for wireless devices implementing CLDC
• J2ME Foundation Profile
– Profile for non-GUI networked devices implementing
• J2ME Personal Basis, Personal, RMI Profiles
– Basic graphics, next generation PersonalJava
environment, and RMI support for CDC & Foundation
Profile based devices
Programming Handheld and
Mobile devices
• 􀀀 Defines minimum set of APIs for Java VM support
– java.lang VM system classes (Object, Thread, etc.)
– java.util.Underlying utilities
– Datagram and File URL
– java.text.I18n support for Java VM error messages
– grain security and encryption for
object serialization
Programming Handheld and
Mobile devices
CVM Sizes Today
• CVM only
– Static ROM + RAM req.= 258 KB
• Natives only
– Static ROM + RAM req.= 124 KB
• Porting layer only
– Static ROM + RAM req.= 28 KB
• CVM+natives+porting_layer
– Static ROM + RAM req.= 410 KB
Programming Handheld and
Mobile devices
Foundation Profile APIs
• Defines core set of Java platform functionality
– No GUI
– Subset of JDK 1.3
• Completes full functionality from CDC
– java.lang.Rounds out full java.lang.*(Compiler,
– java.util.Adds full zip support, Timer, etc.
– TCP Socket and HTTP
– out full* (Readers and Writers)
– java.text.Full I18n (Annotation, Collator, Iterators, etc.)
– Code Signing and Certificates
Programming Handheld and
Mobile devices
CVM Sizes with Foundation Profile APIs
• CDC Java libraries (ROMized)
– Static ROM + RAM req.= 1011 KB
• Foundation Java libraries (ROMized)
– Static ROM + RAM req.= 1564 KB
• CDC TOTAL (CVM+natives+porting+libraries)
– Static ROM + RAM req.= 1421 KB
• Java libraries + natives for Foundation Profile
– Static ROM + RAM req = 553 KB
• Foundation TOTAL (CVM+natives+porting+libraries)
– Static ROM + RAM req.= 1974 KB
Programming Handheld and
Mobile devices