1 / 30

Java 2 Platform, Micro Edition (J2ME)

Java 2 Platform, Micro Edition (J2ME). By Xiaorong Wang. Agenda. Introduction CLDC and MIDP Programming with CLDC/MIDP Summary and Resources. Java TM 2 Platform. Java 2 Enterprise Edition (J2EE) Java 2 Standard Edition (J2SE) Java 2 Micro Edition (J2ME). What is J2ME?.

arama
Download Presentation

Java 2 Platform, Micro Edition (J2ME)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Java 2 Platform,Micro Edition (J2ME) By Xiaorong Wang

  2. Agenda • Introduction • CLDC and MIDP • Programming with CLDC/MIDP • Summary and Resources

  3. JavaTM 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. Memory MIDP Interface MIDP J2ME CLDC Interface KVM OS Interface CLDC (Java) KVM (C) Native Call Native Interface Native OS & Apps Java Application Manager Overview MIDlet 1 MIDlet 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. Resources:text, image,… *.java *.class *.jar *.class Manifest File Steps Flowchart Edit Source Code Archive MIDlet Download To Device Compile and Preverify Emulator

  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 satisfythe 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 New() Paused destroyApp() pauseApp() Destroyed startApp() destroyApp() Active

  22. 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)

  23. Using the KToolBar

  24. KToolBar

  25. Building the MIDlet • Compile the Java source files • Preverify the class files • Package: • Jar up the verified class files • Jar up the resource files

  26. Running the Midlet

  27. Agenda • Introduction • CLDC and MIDP • Programming with CLDC/MIDP • Summary and Resources

  28. 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

  29. Resources • http://java.sun.com/j2me • http://www.javaworld.com

More Related