Download presentation
Presentation is loading. Please wait.
1
Java 2 Platform, Micro Edition (J2ME) By Xiaorong Wang
2
Agenda Introduction CLDC and MIDP Programming with CLDC/MIDP Summary and Resources
3
Java TM 2 Platform Java 2 Enterprise Edition (J2EE) Java 2 Standard Edition (J2SE) Java 2 Micro Edition (J2ME)
4
What is J2ME? Java 2 Micro Edition (J2ME) is Sun’s version of Java aimed at machines with limited hardware resources Limited screen size, memory, and processing power PDAs, cell phones, other consumer electronic and embedded devices
5
Configuration The foundation of J2ME is configurations A configuration defines Java APIs and a specification of a java virtual machine A configuration defines a minimum Java platform for a family of devices
6
Two Types of Configuration Connected device configuration (CDC) Connected limited device configuration (CLDC)
7
The Architecture of J2ME
8
Profiles On top of the configurations are the profiles Mobile Information Device Profile (MIDP) The foundation configuration is CLDC MIDP is a profile for mobile information devices, such as: cellular phones, two-way pagers, and PDAs
9
Agenda Introduction CLDC and MIDP Programming with CLDC/MIDP Summary and Resources
10
Overview Native OS & Apps Native Interface KVM OS Interface CLDC (Java) KVM (C) Native Call CLDC Interface J2ME MIDP MIDP Interface Memory Java Application Manager MIDlet 1MIDlet 2
11
Connected, Limited Device Configuration (CLDC) Targets at devices with 160KB to 512KB total memory available for Java technology Limited power (often battery) Limited connectivity to a network (often wireless) Extremely constrained UI, small screens
12
CLDC Language and VM Compatibility Full Java Language and Java Virtual Machine Specification compatibility Language-level different: Floating point not supported in CLDC 1.0 CLDC libraries are limited
13
CLDC Libraries Classes inherited from Java 2 Platform, Standard Edition (J2SE version 1.3) are in packages: java.lang.* java.util.* java.io.* New classes introduced by CLDC: javax.microedition.*
14
MIDP: Overview Mobile Information Device Profile (MIDP) covers Timers Application lifecycle Persistent storage Networking User interface
15
MIDP: Libraries Classes inherited from J2SE: java.lang.*: IllegalStateException java.util.*: Timer, TimerTask New classes introduced by MIDP: javax.microedition.rms.* javax.microedition.midlet.* javax.microedition.io.* javax.microedition.lcdui.*
16
Agenda Introduction CLDC and MIDP Programming with CLDC/MIDP Summary and Resources
17
Steps Flowchart Edit Source Code Compile and Preverify Emulator *.java *.class Archive MIDlet Download To Device *.jar *.class Resources:text, image,… Manifest File
18
import javax.microedition.midlet.*; import javax.microedition.lcdui.*; public class HelloMidlet extends MIDlet implements CommandListener { // Initialize the Midlet Display variable private Display midletDisplay; // Initialize a variable for the doneCommand private Command doneCommand; public HelloMidlet() { // Retrieve the display from the static display object midletDisplay = Display.getDisplay(this); // Initialize the doneCommand doneCommand = new Command("DONE", Command.SCREEN, 1); }
19
public void startApp() { // Create the TextBox containing the "Hello Midlet World!!" message TextBox textBox = new TextBox("Hello Midlet", "Hello Midlet World!!", 256, 0); // Add the done Command to the TextBox textBox.addCommand(doneCommand); // Set the command listener for the textBox to the current midlet textBox.setCommandListener( (CommandListener) this); // Set the current display of the midlet to the textBox screen midletDisplay.setCurrent(textBox); } public void pauseApp() { } public void destroyApp(boolean unconditional) { }
20
/* The commandAction method is implemented by this * midlet to satisfy the CommandListener interface and * handle the done action. */ public void commandAction(Command command, Displayable screen) { // If the command is the doneCommand if (command == doneCommand) { // Call the destroyApp method destroyApp(false); // Notify the midlet platform that the midlet has completed notifyDestroyed(); }
21
Life Cycle Of Midlet Paused Active Destroyed pauseApp() startApp() destroyApp() New()
22
Developing Tools Java 2 Standard Edition, version 1.3.0 or higher (http://java.sun.com/j2se/1.3)http://java.sun.com/j2se/1.3 J2ME Wireless Toolkit (http://java.sun.com/products/j2mewtoolkit)http://java.sun.com/products/j2mewtoolkit
23
Using the KToolBar
25
KToolBar
26
Building the MIDlet Compile the Java source files Preverify the class files Package: Jar up the verified class files Jar up the resource files
27
Running the Midlet
28
Agenda Introduction CLDC and MIDP Programming with CLDC/MIDP Summary and Resources
29
Summary Some of the companies that making J2ME products: Research in Motion (RIM): Blackberry two- way handhelds Nokia: Mobile phones NEXTEL: Mobile phones – i85s and i50sx American Express: Java Card for its Blue credit cards
30
Resources http://java.sun.com/j2me http://www.javaworld.com
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.