SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Lab 1
Introduction to J2ME
      Pervasive Computing Lab
      Prepared by: Tuan Nguyen
   E-mail: T.Nguyen@latrobe.edu.au
Java Micro-Edition




  Image from java.sun.com
K virtual machine
• The K virtual machine (KVM) is Sun's newest
  Java virtual machine technology and is
  designed for products with approximately
  128K of available memory.
• This environment is highly optimized for small-
  memory limited-resource connected devices
  such as cellular phones, pagers, PDAs
• http://java.sun.com/products/cldc/wp/
Configuration for Small Devices-CLDC

• CLDC: The Connected Limited Device
  Configuration.
  – Example: devices with 128 to 512KB of memory available
    for Java applications.




                     Mobile phones, PDAs
MIDP
• Mobile Information Device Profile (MIDP): A
  widely adopted example is to combine the
  CLDC with the MIDP to provide a complete
  Java application environment for mobile
  phones and other devices with similar
  capabilities.
• The latest versions of MIDP is 2.1
• The latest versions of CLDC 1.1
What is JSR ?
• The Java Community Process (JCP): is a
  participative process to develop and revise the
  Java™ technology specifications, reference
  implementations, and test suites
  (http://jcp.org)
• Java Specification Requests
   – JSR-82: Bluetooth API
   – JSR-120: Wireless Messaging API
   – JSR-179: Location API
• Find suitable devices:
   – Ex: http://www.forum.nokia.com/devices/E61i
MIDLet Life Cycle*
• MIDP applications are managed by the
  Application Management Software (AMS) on
  devices.
• The AMS starts, stops, or pauses the MIDP
  application by calling its main MIDlet class’s
  life cycle methods.
• The MIDlet can also notify the AMS when its
  state changes.
• javax.microedition.midlet.MIDlet

             *: M. J. Yuan, Enterprise J2ME Developing Mobile Java Application, Prentice Hall, 2004
MIDLet Life Cycle Methods
      Method                        Description
startApp()          Called by the AMS when the MIDlet starts to
                    recover from the pause state
destroyApp()        Called by the AMS when the MIDlet is
                    terminated
pauseApp()          Called by the AMS when the MIDlet is paused

notifyDestroyed()   Called by the MIDlet. It asks the AMS to
                    destroy the MIDlet itself
notifyPaused()      Called by the MIDlet. It asks the AMS to pause
                    the MIDlet itself.
resumeRequest()     Called by the MIDlet. It notifies the AMS that
                    MIDlet desires to come out of the paused state
                    and become active again
HelloWorld.java
import javax.microedition.lcdui.*;
import javax.microedition.midlet.*;
public class HelloWorld extends MIDlet {
  Alert strAlert;
  public HelloWorld() {
    strAlert = new Alert("Alert!");
    strAlert.setString("Hello World")
  }
  public void startApp() {
    Display.getDisplay(this).setCurrent(strAlert);
    }
    public void pauseApp() {}
    public void destroyApp(boolean unconditional)
    {}
}
Run project
• Click on
  Run
  button
Examine the files
• Check those directory:
   – .bin ; .classes; .res
• Examine the file: .binHelloWorld.jad and
  .binMANIFEST.MF
   –   MIDlet-1: HelloWorld, HelloWorld.png, HelloWorld
   –   MIDlet-Jar-Size: 100
   –   MIDlet-Jar-URL: HelloWorld.jar
   –   MIDlet-Name: HelloWorld
   –   MIDlet-Vendor: Unknown
   –   MIDlet-Version: 1.0
   –   MicroEdition-Configuration: CLDC-1.1
   –   MicroEdition-Profile: MIDP-2.1
References
1. Java.sun.com
2. JCP – http://jcp.org
3. Michael Juntao Yuan, Enterprise J2ME
   Developing Mobile Java Application, Prentice
   Hall, 2004
4. www.forum.nokia.com

Weitere ähnliche Inhalte

Andere mochten auch

Social Action Evaluation
Social Action EvaluationSocial Action Evaluation
Social Action EvaluationChloeandRachel
 
A socialización diferencial
A socialización diferencialA socialización diferencial
A socialización diferencialmarcendon
 
Tempo October 2013
Tempo October 2013 Tempo October 2013
Tempo October 2013 Tempoplanet
 
British Library OpenWayback
British Library OpenWaybackBritish Library OpenWayback
British Library OpenWaybackRoger Coram
 
Unplugged Mobile Controls User Group Kickoff Meeting
Unplugged Mobile Controls User Group Kickoff MeetingUnplugged Mobile Controls User Group Kickoff Meeting
Unplugged Mobile Controls User Group Kickoff MeetingTeamstudio
 
Stress on Students
Stress on StudentsStress on Students
Stress on Studentsudgamschool
 
Presentation1
Presentation1Presentation1
Presentation1DBABI2389
 
Pschological aspects of child care
Pschological aspects of child carePschological aspects of child care
Pschological aspects of child careAswini S
 
Carbonmonoxide poisoning
Carbonmonoxide poisoningCarbonmonoxide poisoning
Carbonmonoxide poisoningAndan N
 
Wireless Wednesdays: Introduction to XControls
Wireless Wednesdays: Introduction to XControlsWireless Wednesdays: Introduction to XControls
Wireless Wednesdays: Introduction to XControlsTeamstudio
 
April Unplugged Mobile Controls User Group
April Unplugged Mobile Controls User Group April Unplugged Mobile Controls User Group
April Unplugged Mobile Controls User Group Teamstudio
 
PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...
PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...
PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...Brawijaya University
 
Mini Evaluation (Posters)
Mini Evaluation (Posters)Mini Evaluation (Posters)
Mini Evaluation (Posters)ChloeandRachel
 
You Should Click on This
You Should Click on ThisYou Should Click on This
You Should Click on ThisMITCPS
 

Andere mochten auch (17)

Social Action Evaluation
Social Action EvaluationSocial Action Evaluation
Social Action Evaluation
 
A socialización diferencial
A socialización diferencialA socialización diferencial
A socialización diferencial
 
Tempo October 2013
Tempo October 2013 Tempo October 2013
Tempo October 2013
 
British Library OpenWayback
British Library OpenWaybackBritish Library OpenWayback
British Library OpenWayback
 
Unplugged Mobile Controls User Group Kickoff Meeting
Unplugged Mobile Controls User Group Kickoff MeetingUnplugged Mobile Controls User Group Kickoff Meeting
Unplugged Mobile Controls User Group Kickoff Meeting
 
Pemb.kooperatif
Pemb.kooperatifPemb.kooperatif
Pemb.kooperatif
 
Ert yati 2
Ert yati 2Ert yati 2
Ert yati 2
 
Stress on Students
Stress on StudentsStress on Students
Stress on Students
 
Presentation1
Presentation1Presentation1
Presentation1
 
Pschological aspects of child care
Pschological aspects of child carePschological aspects of child care
Pschological aspects of child care
 
Virtual Piano
Virtual PianoVirtual Piano
Virtual Piano
 
Carbonmonoxide poisoning
Carbonmonoxide poisoningCarbonmonoxide poisoning
Carbonmonoxide poisoning
 
Wireless Wednesdays: Introduction to XControls
Wireless Wednesdays: Introduction to XControlsWireless Wednesdays: Introduction to XControls
Wireless Wednesdays: Introduction to XControls
 
April Unplugged Mobile Controls User Group
April Unplugged Mobile Controls User Group April Unplugged Mobile Controls User Group
April Unplugged Mobile Controls User Group
 
PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...
PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...
PRODUKSI GAS DAN DEGRADASI BAHAN KERING DAN BAHAN ORGANIK IN VITRO SILASE PAK...
 
Mini Evaluation (Posters)
Mini Evaluation (Posters)Mini Evaluation (Posters)
Mini Evaluation (Posters)
 
You Should Click on This
You Should Click on ThisYou Should Click on This
You Should Click on This
 

Ähnlich wie Lab 1 new

Java ME CLDC MIDP
Java ME CLDC MIDPJava ME CLDC MIDP
Java ME CLDC MIDPSMIJava
 
Mobile Application Development MAD J2ME UNIT 2
Mobile Application Development  MAD J2ME UNIT 2Mobile Application Development  MAD J2ME UNIT 2
Mobile Application Development MAD J2ME UNIT 2Pallepati Vasavi
 
Session 3 J2ME Mobile Information Device Profile(MIDP) API
Session 3 J2ME Mobile Information Device Profile(MIDP)  APISession 3 J2ME Mobile Information Device Profile(MIDP)  API
Session 3 J2ME Mobile Information Device Profile(MIDP) APImuthusvm
 
J2me Crash Course
J2me Crash CourseJ2me Crash Course
J2me Crash Courseguest860a03
 
Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)Fafadia Tech
 
Introduction to Mobile Application Development
Introduction to Mobile Application DevelopmentIntroduction to Mobile Application Development
Introduction to Mobile Application DevelopmentSenthil Kanth
 
Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1Marlon Luz
 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008Vando Batista
 
Improving app performance with Kotlin Coroutines
Improving app performance with Kotlin CoroutinesImproving app performance with Kotlin Coroutines
Improving app performance with Kotlin CoroutinesHassan Abid
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkbanq jdon
 
Automated Abstraction of Flow of Control in a System of Distributed Software...
Automated Abstraction of Flow of Control in a System of Distributed  Software...Automated Abstraction of Flow of Control in a System of Distributed  Software...
Automated Abstraction of Flow of Control in a System of Distributed Software...nimak
 

Ähnlich wie Lab 1 new (20)

Scmad Chapter03
Scmad Chapter03Scmad Chapter03
Scmad Chapter03
 
Java ME CLDC MIDP
Java ME CLDC MIDPJava ME CLDC MIDP
Java ME CLDC MIDP
 
Mobile Application Development MAD J2ME UNIT 2
Mobile Application Development  MAD J2ME UNIT 2Mobile Application Development  MAD J2ME UNIT 2
Mobile Application Development MAD J2ME UNIT 2
 
08 Midlet Basic
08 Midlet Basic08 Midlet Basic
08 Midlet Basic
 
Session 3 J2ME Mobile Information Device Profile(MIDP) API
Session 3 J2ME Mobile Information Device Profile(MIDP)  APISession 3 J2ME Mobile Information Device Profile(MIDP)  API
Session 3 J2ME Mobile Information Device Profile(MIDP) API
 
J2me Crash Course
J2me Crash CourseJ2me Crash Course
J2me Crash Course
 
Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)Introduction To J2ME(FT - Prasanjit Dey)
Introduction To J2ME(FT - Prasanjit Dey)
 
J2ME
J2MEJ2ME
J2ME
 
Introduction to Mobile Application Development
Introduction to Mobile Application DevelopmentIntroduction to Mobile Application Development
Introduction to Mobile Application Development
 
03 midp
03 midp03 midp
03 midp
 
Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1Nokia Asha App Development - Part 1
Nokia Asha App Development - Part 1
 
Mobile Java
Mobile JavaMobile Java
Mobile Java
 
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008"JavaME + Android in action" CCT-CEJUG Dezembro 2008
"JavaME + Android in action" CCT-CEJUG Dezembro 2008
 
Developing midlets
Developing midletsDeveloping midlets
Developing midlets
 
J2me Platform
J2me PlatformJ2me Platform
J2me Platform
 
Android - Anatomy of android elements & layouts
Android - Anatomy of android elements & layoutsAndroid - Anatomy of android elements & layouts
Android - Anatomy of android elements & layouts
 
Improving app performance with Kotlin Coroutines
Improving app performance with Kotlin CoroutinesImproving app performance with Kotlin Coroutines
Improving app performance with Kotlin Coroutines
 
DDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFrameworkDDD Framework for Java: JdonFramework
DDD Framework for Java: JdonFramework
 
Java J2ME
Java J2MEJava J2ME
Java J2ME
 
Automated Abstraction of Flow of Control in a System of Distributed Software...
Automated Abstraction of Flow of Control in a System of Distributed  Software...Automated Abstraction of Flow of Control in a System of Distributed  Software...
Automated Abstraction of Flow of Control in a System of Distributed Software...
 

Lab 1 new

  • 1. Lab 1 Introduction to J2ME Pervasive Computing Lab Prepared by: Tuan Nguyen E-mail: T.Nguyen@latrobe.edu.au
  • 2. Java Micro-Edition Image from java.sun.com
  • 3. K virtual machine • The K virtual machine (KVM) is Sun's newest Java virtual machine technology and is designed for products with approximately 128K of available memory. • This environment is highly optimized for small- memory limited-resource connected devices such as cellular phones, pagers, PDAs • http://java.sun.com/products/cldc/wp/
  • 4. Configuration for Small Devices-CLDC • CLDC: The Connected Limited Device Configuration. – Example: devices with 128 to 512KB of memory available for Java applications. Mobile phones, PDAs
  • 5. MIDP • Mobile Information Device Profile (MIDP): A widely adopted example is to combine the CLDC with the MIDP to provide a complete Java application environment for mobile phones and other devices with similar capabilities. • The latest versions of MIDP is 2.1 • The latest versions of CLDC 1.1
  • 6. What is JSR ? • The Java Community Process (JCP): is a participative process to develop and revise the Java™ technology specifications, reference implementations, and test suites (http://jcp.org) • Java Specification Requests – JSR-82: Bluetooth API – JSR-120: Wireless Messaging API – JSR-179: Location API • Find suitable devices: – Ex: http://www.forum.nokia.com/devices/E61i
  • 7. MIDLet Life Cycle* • MIDP applications are managed by the Application Management Software (AMS) on devices. • The AMS starts, stops, or pauses the MIDP application by calling its main MIDlet class’s life cycle methods. • The MIDlet can also notify the AMS when its state changes. • javax.microedition.midlet.MIDlet *: M. J. Yuan, Enterprise J2ME Developing Mobile Java Application, Prentice Hall, 2004
  • 8. MIDLet Life Cycle Methods Method Description startApp() Called by the AMS when the MIDlet starts to recover from the pause state destroyApp() Called by the AMS when the MIDlet is terminated pauseApp() Called by the AMS when the MIDlet is paused notifyDestroyed() Called by the MIDlet. It asks the AMS to destroy the MIDlet itself notifyPaused() Called by the MIDlet. It asks the AMS to pause the MIDlet itself. resumeRequest() Called by the MIDlet. It notifies the AMS that MIDlet desires to come out of the paused state and become active again
  • 9. HelloWorld.java import javax.microedition.lcdui.*; import javax.microedition.midlet.*; public class HelloWorld extends MIDlet { Alert strAlert; public HelloWorld() { strAlert = new Alert("Alert!"); strAlert.setString("Hello World") } public void startApp() { Display.getDisplay(this).setCurrent(strAlert); } public void pauseApp() {} public void destroyApp(boolean unconditional) {} }
  • 10. Run project • Click on Run button
  • 11. Examine the files • Check those directory: – .bin ; .classes; .res • Examine the file: .binHelloWorld.jad and .binMANIFEST.MF – MIDlet-1: HelloWorld, HelloWorld.png, HelloWorld – MIDlet-Jar-Size: 100 – MIDlet-Jar-URL: HelloWorld.jar – MIDlet-Name: HelloWorld – MIDlet-Vendor: Unknown – MIDlet-Version: 1.0 – MicroEdition-Configuration: CLDC-1.1 – MicroEdition-Profile: MIDP-2.1
  • 12. References 1. Java.sun.com 2. JCP – http://jcp.org 3. Michael Juntao Yuan, Enterprise J2ME Developing Mobile Java Application, Prentice Hall, 2004 4. www.forum.nokia.com