Introduction to java 2 platform

Embed Size (px)

Citation preview

  • 8/6/2019 Introduction to java 2 platform

    1/43

    Introduction to J2ME

    Presented By:

    http://www.sun.com/http://java.sun.com/http://java.sun.com/j2me/
  • 8/6/2019 Introduction to java 2 platform

    2/43

    J2ME 2

    Contents

    Whats J2ME?

    Java Editions

    J2ME core concepts

    Configurations (CLDC, CDC) Profiles (MIDP)

    MIDP and MIDlets

    Basic Classes API

    Java Technology Carriers

    Java Technology Handsets

    Overall Evaluation

  • 8/6/2019 Introduction to java 2 platform

    3/43

    J2ME 3

    Introduction

    Personalized and intelligent informationappliances are necessities in our life today.

    Such appliances can be:

    cell phones

    two-way pagers

    smart cards personal organizers

    palmtops These appliances tend to be special-purpose,

    limited-resource, network-connected devices.

  • 8/6/2019 Introduction to java 2 platform

    4/43

    J2ME 4

    Environment requirements

    We need an environment which is adaptedfor constrained devices - devices that havelimitations on what they can do when

    compared to standard desktop or servercomputers.

    The constraints are: extremely limited memory

    small screen sizes

    alternative input methods

    slow processors

  • 8/6/2019 Introduction to java 2 platform

    5/43

    At the JavaOne Conference in June 1999,Sun Microsystems announced a new editionof the Java 2 platform: the Java 2 Micro

    Edition (J2ME).

    J2ME 5

  • 8/6/2019 Introduction to java 2 platform

    6/43

    J2ME 6

    Java Editions

    Different devices have differentrequirements and different expectations ofJava.

    One platform (solution) cannot address allthe market segments (web server, videogames etc.)

    Users/developers want flexibility. Theywant to choose what they want to use andwhat they do not.

  • 8/6/2019 Introduction to java 2 platform

    7/43

    J2ME 7

    Java Editions

    The Java 2 Platform is split into threeeditions.

    Each edition provides a complete

    environment for running Java-basedapplications, including the Java virtualmachine (VM) and runtime classes.

    The three editions target different kinds ofapplications running on different kinds ofdevices.

  • 8/6/2019 Introduction to java 2 platform

    8/43

    J2ME 8

    Java Editions

    Java2Standard Edition

    (J2SE)

    Java2Enterprise Edition

    (J2EE)

    Java2Micro Edition

    (J2ME)

    Java 2 Platform

    Standard desktop &workstation applications

    Heavy duty serversystems

    Small & memoryconstrained devices

  • 8/6/2019 Introduction to java 2 platform

    9/43

    J2ME 9

    Java Editions

    Each edition defines different sets ofclass libraries.

    There are thousands of core J2SE

    runtime classes, taking up to 10-20megabytesof space.

    J2ME-based devices havefewer classes.

    J2ME

    J2SE

    J2EE

  • 8/6/2019 Introduction to java 2 platform

    10/43

    Java Family

  • 8/6/2019 Introduction to java 2 platform

    11/43

    What is J2ME

    J2ME is a family of specifications thatdefines various downsized versions of thestandard Java 2 platform; these downsizedversions can be used to program consumer

    electronic devices ranging from cell phonesto highly capable Personal Data Assistants(PDAs), smart phones, and set-top boxes.

    ---J2ME in a Nutshell A Desktop Quick Reference

    ByKim Topley

  • 8/6/2019 Introduction to java 2 platform

    12/43

    J2ME 12

    PersonalJava and EmbeddedJava

    J2ME is not the first attempt at adaptingJava for constrained environments.

    PersonalJava

    EmbeddedJava

  • 8/6/2019 Introduction to java 2 platform

    13/43

    Sun Microsystems Web sitedescribes J2ME this way:

    . . . Java 2 Platform, Micro Edition is a highlyoptimized Java runtime environment

    targeting a wide range of consumerproducts, including pagers, cellular phones,screenphones,digital set-top boxes and carnavigation systems.

    J2ME 13

  • 8/6/2019 Introduction to java 2 platform

    14/43

    J2ME 14

    J2ME Core Concepts

    J2ME is based on 3 core concepts:

    Configurations

    Profiles Optional packages

  • 8/6/2019 Introduction to java 2 platform

    15/43

    J2ME Category

    Principle: Different hardware corresponds different JVMs, hardware which base on CDC havepowerful JVMs, and hardware which base on CLDC have KVM to support.

    J2ME Model

    http://www.yesky.com/20011004/jt-2001-10-4-rgfig1.gifhttp://www.yesky.com/20011004/jt-2001-10-4-rgfig1.gifhttp://www.yesky.com/20011004/jt-2001-10-4-rgfig1.gifhttp://www.yesky.com/20011004/jt-2001-10-4-rgfig1.gifhttp://www.yesky.com/20011004/jt-2001-10-4-rgfig1.gifhttp://www.yesky.com/20011004/jt-2001-10-4-rgfig1.gif
  • 8/6/2019 Introduction to java 2 platform

    16/43

    J2ME 16

    Configurations

    A configuration is a complete Javaruntime environment, consisting of: Java virtual machine (VM) to execute

    Java bytecode

    Native code to interface to theunderlying system

    Set of core Java runtime classes

    To use a configuration, a device mustmeet certain minimum requirements.

  • 8/6/2019 Introduction to java 2 platform

    17/43

    J2ME 17

    Configurations

    The set of core classes is normallyquite small and must be enhancedwith additional classes supplied byJ2ME profiles or by configurationimplementor.

    Configurations do not define any user

    interface classes.

  • 8/6/2019 Introduction to java 2 platform

    18/43

    J2ME 18

    Configurations

    Configuration

    CLDC CDC

    Connected Limited

    Device Configuration

    Connected Device

    Configuration

  • 8/6/2019 Introduction to java 2 platform

    19/43

    19

    Connected Device Configuration (CDC)

    Device requirements: A connected device (CD)has a minimum 512KB of ROM, 256KB of RAM,32-bit processors, and some network

    connection with limited bandwidth CDC is designed for "more powerful" wireless

    devices like TV set-top boxes, car navigationsystems, and high-end PDAs.

    CDC specifies that a full-featured Java VirtualMachine (JVM) (defined in J2EE) is supported

  • 8/6/2019 Introduction to java 2 platform

    20/43

    20

    Connected, Limited DeviceConfiguration (CLDC)

    Covers mobile devices like mobile phones, PDAs,

    pagers, and other "tiny" wireless devices

    For smaller devices than CDC, with limited capacity

    and network connection For devices with 160KB to 512 KB of memory

    available for Java platform

    For devices with limited power supply

    Built on "scale-down" version of JVM called KVM

    (Sun 'K Virtual Machine, with size in tens of

    kilobytes, rather than JVM with tens of megabytes)

  • 8/6/2019 Introduction to java 2 platform

    21/43

    J2ME 21

    J2ME Core Concepts

    J2ME is based on 3 core concepts:

    Configurations

    Profiles

    Optional packages

  • 8/6/2019 Introduction to java 2 platform

    22/43

    J2ME 22

    Profiles

    Adds domain-specific classes to aconfiguration: To fill in missing functionality

    To support specific uses of a device Most profiles define user interface classes

    for building interactive applications.

    To use a profile, the device must meet the

    minimum requirements of the underlyingconfiguration and of the profile.

  • 8/6/2019 Introduction to java 2 platform

    23/43

    J2ME 23

    Profiles

    Profile

    MIDP PDAP PPPBPFP

    Mobile

    Information

    Device

    Profile

    Personal

    Digital

    Assistant

    Profile

    Foundation

    Profile

    Personal

    Basis Profile

    Personal

    Profile

  • 8/6/2019 Introduction to java 2 platform

    24/43

    J2ME 24

    MIDP MID Profile

    MIDP is targeted at a class of devicesknown as mobile information devices(MIDs).

    Minimal characteristics of MIDs: Enough memory to run MIDP applications

    Display of at least 96 X 56 pixels, eithermonochrome or color

    A keypad, keyboard, or touch screen Two-way wireless networking capability

  • 8/6/2019 Introduction to java 2 platform

    25/43

    J2ME 25

    MIDP - Specification

    The MIDP adds APIs to the basic APIs defined bythe CLDC. The new features include:

    Support for application lifecycle management similarto the way applets are defined in J2SE.

    Persistent storage of data.

    HTTP-based network connectivity based on theCLDC's GCF.

    Simple user interface support, with enough flexibility

    to build games or business applications.

  • 8/6/2019 Introduction to java 2 platform

    26/43

    J2ME 26

    MIDP - Specification

    The MIDP specification is silent abouta number of things: No standard way to interface to the

    device's phonebook, in order to initiatevoice calls.

    How MIDP applications are loaded onto adevice and how they are activated ordeactivated.

  • 8/6/2019 Introduction to java 2 platform

    27/43

    J2ME 27

    MIDP Applications restrictions

    Memory is a particularly scarce resource. The early Motorola J2ME-enabled phones limited

    the size of an application to 50K. Some Nokia

    phones limit them to even less, about 30K. MIDP 1.0 applications cannot share classes.

    Placing part of the application in a web orapplication server (as a servlet, typically)

    that the MIDP application calls is almost arequirement for anything serious.

  • 8/6/2019 Introduction to java 2 platform

    28/43

    MIDP API(familiar packages)

    java.io

    java.lang

    java.lang.ref

    java.util

  • 8/6/2019 Introduction to java 2 platform

    29/43

    MIDP API(no so familiar packages)

    javax.microedition.io

    javax.microedition.lcdui

    javax.microedition.lcdui.game

    javax.microedition.media

    javax.microedition.media.control

    javax.microedition.midlet

    javax.microedition.pki javax.microedition.rms

  • 8/6/2019 Introduction to java 2 platform

    30/43

    30

    MIDP and MIDlets

    MIDP enables application development with mobile, wireless-connected devices like cellular phones and two-way pagers

    Main features of the supported devices: small displays limited input devices

    limited local storage limited battery life limited CPU power

    MIDlets: Small applications that run under the MIDP are called MIDlets A MIDlet is a Java application that uses the MIDP and the CLDC

    In a mobile phone, application management software (AMS)controls start, stop and execute MIDlet (controls the entirelifecycle)

    Device manufacturer provides the AMS Software

  • 8/6/2019 Introduction to java 2 platform

    31/43

    31

    MIDlet states

  • 8/6/2019 Introduction to java 2 platform

    32/43

    J2ME 32

    MIDlets The heart of J2ME

    Every application must extendjavax.microedition.midlet.MIDletclass to allow the application

    management software to: control the MIDlet

    be able to retrieve properties from the

    application descriptor notify and request state changes

  • 8/6/2019 Introduction to java 2 platform

    33/43

    J2ME 33

    J2ME Core Concepts

    J2ME is based on 3 core concepts:

    Configurations

    Profiles

    Optional packages

  • 8/6/2019 Introduction to java 2 platform

    34/43

    J2ME 34

    Optional Packages

    Set of APIs in support of additional,common behaviors.

    Have specific dependencies on a particular

    configuration and/or one or more profiles.

    Examples of optional packages :

    RMI Optional Package

    Bluetooth Optional Package JDBC Optional Package

  • 8/6/2019 Introduction to java 2 platform

    35/43

    J2ME 35

    What it all means

    "J2ME application" is an ambiguous term.

    Configuration, profile and optionalpackages should be chosen.

    CDC-based profiles make developmentsimpler due to J2SE-like APIs, but dont suitthe low-end devices.

    CLDC-based profiles makes the

    development task harder, especially whentrying to shrink the size of the applicationto run on many of the small devices.

    C i

  • 8/6/2019 Introduction to java 2 platform

    36/43

    Carriers

    H d t

  • 8/6/2019 Introduction to java 2 platform

    37/43

    Handsets

    To date, over 250 different handset models from more than 40 manufacturershave been developed with Java technology, with more than 100 million of thesehandsets shipped worldwide.

  • 8/6/2019 Introduction to java 2 platform

    38/43

    Overall Evaluation

    Advantages Easy to learn Learning J2ME is like learning Java programs

    Platform independent The layering architecture of the J2ME

    programming model allows MIDlets(applications for mobile devices) to run on

    different mobile devices (Java systems). Build on top of an operating system and All lower levels components are hided by the

    OS

  • 8/6/2019 Introduction to java 2 platform

    39/43

    Overall Evaluation

    Integration with other Javacomponents Can build complex mobile applications

    using with least effort by integration withother Java components

    Good for security-oriented applications,which use cryptographic classes

    Can build wireless Internet applications

  • 8/6/2019 Introduction to java 2 platform

    40/43

    Overall Evaluation

    Limitations

    Accessing device resources

    Multimedia applications

    Performance-intensive applications

  • 8/6/2019 Introduction to java 2 platform

    41/43

    Overall Evaluation

    There are more than 2.1 billion Java MEenabled mobile phones and PDAs, but it isbecoming old technology as it is not used

    on any of today's newest mobile platforms(eg iPhone, Android, Windows Phone 7,MeeGo, BlackBerry's new QNX).

  • 8/6/2019 Introduction to java 2 platform

    42/43

    J2ME 42

    Getting Started

    1st step: Download suns J2MEWireless Toolkit from:http://java.sun.com/products/j2mewtool

    kit/download-2_1.html

    2nd step:Make sure you have J2SESDK installed

    3rd step: Install the J2ME Toolkit.

  • 8/6/2019 Introduction to java 2 platform

    43/43

    Thanks