Download - Java 2 Platform, Micro Edition (J2ME)
![Page 1: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/1.jpg)
Java 2 Platform,Micro Edition (J2ME)
By Xiaorong Wang
![Page 2: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/2.jpg)
Agenda
IntroductionCLDC and MIDPProgramming with CLDC/MIDPSummary and Resources
![Page 3: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/3.jpg)
JavaTM 2 Platform
Java 2 Enterprise Edition (J2EE)Java 2 Standard Edition (J2SE)Java 2 Micro Edition (J2ME)
![Page 4: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/4.jpg)
What is J2ME?Java 2 Micro Edition (J2ME) is Sun’s version of Java aimed at machines with limited hardware resourcesLimited screen size, memory, and processing powerPDAs, cell phones, other consumer electronic and embedded devices
![Page 5: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/5.jpg)
ConfigurationThe foundation of J2ME is configurationsA configuration defines Java APIs and a specification of a java virtual machineA configuration defines a minimum Java platform for a family of devices
![Page 6: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/6.jpg)
Two Types of Configuration
Connected device configuration (CDC)Connected limited device configuration (CLDC)
![Page 7: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/7.jpg)
The Architecture of J2ME
![Page 8: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/8.jpg)
Profiles
On top of the configurations are the profilesMobile Information Device Profile (MIDP)The foundation configuration is CLDCMIDP is a profile for mobile information
devices, such as: cellular phones, two-way pagers, and PDAs
![Page 9: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/9.jpg)
Agenda
IntroductionCLDC and MIDPProgramming with CLDC/MIDPSummary and Resources
![Page 10: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/10.jpg)
Overview
Native OS & AppsNative Interface
KVM OS Interface
CLDC (Java)KVM (C)
Native C
all
CLDC Interface
J2M
E MIDPMIDP Interface
Memory
Java Application Manager
MIDlet 1 MIDlet 2
![Page 11: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/11.jpg)
Connected, Limited Device Configuration
(CLDC)Targets at devices with160KB to 512KB total memory available
for Java technologyLimited power (often battery)Limited connectivity to a network (often
wireless)Extremely constrained UI, small screens
![Page 12: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/12.jpg)
CLDC Language and VM Compatibility
Full Java Language and Java Virtual Machine Specification compatibilityLanguage-level different: Floating point not supported in CLDC 1.0CLDC libraries are limited
![Page 13: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/13.jpg)
CLDC LibrariesClasses 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.*
![Page 14: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/14.jpg)
MIDP: OverviewMobile Information Device Profile (MIDP) coversTimersApplication lifecyclePersistent storageNetworkingUser interface
![Page 15: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/15.jpg)
MIDP: LibrariesClasses inherited from J2SE:java.lang.*: IllegalStateExceptionjava.util.*: Timer, TimerTask
New classes introduced by MIDP:javax.microedition.rms.*javax.microedition.midlet.*javax.microedition.io.*javax.microedition.lcdui.*
![Page 16: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/16.jpg)
Agenda
IntroductionCLDC and MIDPProgramming with CLDC/MIDPSummary and Resources
![Page 17: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/17.jpg)
Steps Flowchart
Edit Source CodeEdit Source Code
Compile and PreverifyCompile and Preverify
EmulatorEmulator
*.java
*.class
ArchiveMIDlet
DownloadTo Device
*.jar*.class
Resources:text, image,…
Manifest File
![Page 18: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/18.jpg)
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); }
![Page 19: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/19.jpg)
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){}
![Page 20: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/20.jpg)
/* 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(); } }}
![Page 21: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/21.jpg)
Life Cycle Of Midlet
PausedPaused
ActiveActive
DestroyedDestroyedpauseApp()
startApp()
destroyApp()
destroyApp()
New()
![Page 22: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/22.jpg)
Developing Tools
Java 2 Standard Edition, version 1.3.0 or higher (http://java.sun.com/j2se/1.3)
J2ME Wireless Toolkit (http://java.sun.com/products/j2mewtoolkit)
![Page 23: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/23.jpg)
Using the KToolBar
![Page 24: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/24.jpg)
![Page 25: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/25.jpg)
KToolBar
![Page 26: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/26.jpg)
Building the MIDlet
Compile the Java source filesPreverify the class filesPackage:Jar up the verified class filesJar up the resource files
![Page 27: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/27.jpg)
Running the Midlet
![Page 28: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/28.jpg)
Agenda
IntroductionCLDC and MIDPProgramming with CLDC/MIDPSummary and Resources
![Page 29: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/29.jpg)
SummarySome 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
![Page 30: Java 2 Platform, Micro Edition (J2ME)](https://reader033.vdocuments.us/reader033/viewer/2022051517/5681527d550346895dc0a915/html5/thumbnails/30.jpg)
Resources
http://java.sun.com/j2mehttp://www.javaworld.com