Slide 1 : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 1 Welcome Mobile Programming using J2ME – Java 2 Micro Edition.
Small Computing Devices : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 2 Small Computing Devices Characteristics
Minimal H/W support
Limited processing speed
Low screen resolution
Limited storage capacity
Battery powered devices (Frequent recharge required)
No inbuilt DB support
Cannot handle complex applications or processing
Java 2 Platform : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 3 Java 2 Platform Java 2 Platform Java2Standard Edition(J2SE) Java2Enterprise Edition(J2EE) Java2Micro Edition(J2ME) Standard desktop & Workstation Applications Heavy duty server systems Small & memory Constrained devices
J2SE : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 4 J2SE J2SE
Java 2 Standard Edition (Core Java)
Desktop level application
Uses JVM
Applets – Applications level code
J2EE : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 5 J2EE J2EE
Distributed applications
Server side enterprise application
Multi-tier application Model
Uses JVM
Servlet – Server level code
J2ME : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 6 J2ME J2ME
Java 2 Micro Edition
Small Device Application (Mobile, PDAs, etc…)
Uses KVM ( KVM)
MIDlet – Mobile level code
What is KVM? : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 7 What is KVM? KVM – K Virtual Machine
K is for Kilobytes
It is a configurable JVM for J2ME
Implement a complete functional JVM.
Designed for resource-constrained systems
Modular/configurable
Highly portable (Ansi C)
What KVM is Not? : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 8 What KVM is Not? Fast
Byte code interpreter only, no JIT
Full-Featured
Partial support for Java Language
All together : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 9 All together Standard Java Virtual Machine KVM Java 2 Enterprise Edition
(J2EE) Java 2 Standard Edition
(J2SE) CDC CLDC Java 2 Micro Edition(J2ME)
How J2ME is organized : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 10 How J2ME is organized Configurations
Configuration defines the JRE and Core classes that operate on each device
2 types of configuration are available as shown in fig.
CLDC
CDC Connected Limited Device Configuration Connected Device Configuration
Configurations - CLDC : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 11 Configurations - CLDC CLDC – Connected Limited Device Configuration
Designed for 16-bit or 32-bit small computing devices
Have 160KB to 512 KB of available memory.
Battery powered
Use an inconsistence, small bandwidth network wireless connection.
Use KJava Virtual Machine (KVM) which is stripped down version of JVM
Include…
Pagers, PDAs, Cell phones, and Handheld consumer devices with between 128 KB and 512 KB memory
Configurations - CDC : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 12 Configurations - CDC CDC – Connected Device Configuration
CDC Devices use 32-bit architecture
Have at least 2 MB of available memory.
Implement a complete functional JVM.
Include…
Digital set-top boxes, home appliances, navigation systems, and smart phones
Profiles : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 13 Profiles A profile consists of Java classes that enable implementation of features for particular small computing device or its class
Seven profiles have been defined as follows…
The Foundation Profile
The Game Profile
The Mobile Information Device Profile
The PDA Profile
The Personal Profile
The Personal Basis Profile
The RMI Profile
Profiles (contd..) : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 14 Profiles (contd..) The Foundation Profile
FP is used with the CDC
It is core for nearly all other profiles used with the CDC
The Game Profile
GP is also used with CDC
Contains the necessary classes for developing a game application
The Mobile Information Device Profile
Used with the CLDC
Contains classes that provide local storage, a user interface and networking capabilities
Profiles (contd..) : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 15 Profiles (contd..) The PDA Profile
PDA Profile is used with the CLDC
Contains the classes that utilize sophisticated resources found on a PDA
These features include better displays and larger memory compare to MIDP mobile devices
The Personal Profile
is used with CDC and Foundation Profile
Contains classes to implement complex user interface
Provides classes to implement a user interface that is capable of displaying multiple windows at a time.
Profiles (contd..) : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 16 Profiles (contd..) The Personal Basis Profile
PBP is same as Personal Profile in that it uses CDC and Foundation profile.
The PBP provides classes to implementa simple user interface, one window at a time.
The RMI profile
is used with CDC and Foundation Profile
Provides Remote Method Invocation classes to the core classes contained in the Foundation Profiles
J2ME Architecture : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 17 J2ME Architecture OEM- Original Equipment Manufacturer
Small computing device requirements : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 18 Small computing device requirements Following are minimum resources requirements for a small computing device to run a J2ME application.
Hardware Requirements…
Minimum 96 x 54 pixel display
Should have keypad, keyboard or touch screen to accept input from user
At least 128 kilobytes (KB) of nonvolatile memory to run MID, and 8 KB of nonvolatile memory is needed for persistent data storage
32 KB of volatile memory must be available to run JVM
Device must also provide two way network connectivity
Small computing device requirements : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 19 Small computing device requirements Native Operating System requirements
Native O. S. …
Must implement exception handling and process interrupts
Must be able to run the JVM/KVM and provide scheduled capabilities
All user input to the OS must be forwarded to the JVM
Must be able to read and write persistent data
Java language for J2ME : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 20 Java language for J2ME CDC implements the full J2SE, while CLDC implements a stripped down J2SE.
Following are prominent features of J2SE that you cannot implement in J2ME
No support for Floating-point calculations in J2ME
finalize() method is not supported in J2ME
Number of error-handling exceptions reduced in J2ME
You cannot group threads (ThreadGroup class) in J2ME
You cannot call other prog. language’s methods and APIs
weak references and Reflection classes are missing in J2ME
Important terms to remember… : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 21 Important terms to remember… CLDC - Connected Limited Device Configuration
MIDP – Mobile Information Device Profile
MIDlet – A MIDlet is a J2ME application designed to operate on an MIDP device
MIDlet Suite – Collection of MIDlets from same package
JAD – Java Application Descriptor
JAR – Java Application Archive
Java Application Archive (JAR) File : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 22 Java Application Archive (JAR) File All the files necessary to implement a MIDlet suite must be contained within a production package called JAR
JAR file includes following files
MIDlet classes
Graphic Imaged
The Manifest file
Attributes of Manifest file : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 23 Attributes of Manifest file Nine attributes are defined in Manifest file
MIDlet-Name
MIDlet-Version
MIDlet-Vendor
MIDlet-n
MicroEdition-Profile
MicroEdition-Configuration
MIDlet-Icon
MIDlet-Description
MIDlet-Info-URL
Java Application Descriptor (JAD) File : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 24 Java Application Descriptor (JAD) File You may include a JAD file within the JAR file to pass parameters to a MIDlet without modifying the JAR file
Attributes of JAD file
MIDlet-Name
MIDlet-Version
MIDlet-Vendor
MIDlet-n
MIDlet –Jar-URL
MIDlet –Jar-Size
MIDlet-Data-Size
MIDlet-Description
MIDlet-Delete-Confirm
MIDlet-Install-Notify
MIDlet Programming : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 25 MIDlet Programming MIDlet programming is similar to creating a J2SE Application in that you define classes and related methods
A MIDlet is a class that extends the MIDlet class.
A MIDlet class must contain three abstract methods to manage the life cycle of the MIDlet
startApp() is called by Application Manager when MIDlet is started
pauseApp() method is called before the Application Manager temporarily stops the MIDlet
destroyApp() method is called prior to the termination of the MIDlet by the Application Manager
The tools and techniques : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 26 The tools and techniques In next section we will see following…
How to install and use Wireless Tool Kit?
The evergreen HelloWorld Program with J2ME
How to compile and run a MIDlet?
How to transfer your Application from PC to Mobile?
Wireless Toolkit (WTK) : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 27 Wireless Toolkit (WTK) There are different IDE available in the market like…
Borland’s JBuilder
Sun Microsystems’s Forte
NetBeans Mobility Pack
Sun Java Wireless Toolkit
All of the above works best but, official and suggested IDE is Sun Java Wireless Toolkit.
Wireless Toolkit 2.2 : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 28 Wireless Toolkit 2.2 Prerequisites
J2SDK 1.4.2 or higher
Available from…
http://www.java.sun.com/products/sjwtoolkit/download-2_2.html
Minimum System Requirements
P-3 800 MHz CPU
128 MB RAM
50 MB Hard disk space
We will see screenshots of wizard to understand this better
Hierarchy of GUI supported in J2ME : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 29 Hierarchy of GUI supported in J2ME
Record Management System (RMS) : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 30 Record Management System (RMS) Not all small computing devices have a file system
Therefore they are unable to store information in the manner as PC, Server & other traditional computers do
The RMS provides a file-system like environment that is used to store and maintain persistence in a small computing device.
You can use RMS to perform the functionality of DBMS
Means, RMS allows you to Insert, Read, Search and Sort records from stored records.
What RMS is not. : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 31 What RMS is not. RMS is not a Relational Database
You cannot SQL to interact with the data.
Instead, you’ll use
the RMS application programming interface
enumeration application programming
Record Enumeration : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 32 Record Enumeration Record Enumeration is an interface that allows you to sort and search records from RMS
An Enumeration provides a way to traverse data elements.
The enumeration object manages how data is retrieved from the record store.
Changes to the record store are reflected when the record store’s content is iterated
Generic Connection Framework : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 33 Generic Connection Framework A connection is a path between two computing devices that utilizes a hard-wired technology or wireless technology to transmit & receive data over a network
These devices can be
a small computing device and a back-end processing system OR
Two small computing devices.
Three pieces of information are required …
Network address, Comm. Protocol, Comm. Para
Important Links… : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 34 Important Links… Official J2ME website
http://www.java.sun.com/javame/index.jsp
J2ME Reference
http://www.java.sun.com/javame/reference/index.jsp
Docs, APIs, Code Samples & Apps
Technical Articles and Tips, Information about Devices
Downloads (WTK and others)
http://www.java.sun.com/javame/download/index.jsp
Sun Developer Network
http://www.developers.sun.com/index.html
Contd...
Important Links… (Contd…) : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 35 Important Links… (Contd…) J2ME Resources and tools
http://www.corej2me.com
J2ME Reference
http://www.java.com/en/mobile
J2ME Resources and Free books
http://www.j2meolympus.com/freebooks/freej2mebooks.jsp
http://www.javaworld.com
http://www.billday.com/j2me/
Nokia Forum for J2ME
http://www.forum.nokia.com/ Contd...
Suggested Books : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 36 Suggested Books J2ME Complete Reference – James Keogh (TMH)
Bibliography : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 37 Bibliography J2ME Complete Reference – James Keogh (TMH)
Official Java Website – http://www.java.sun.com
Thank You : Parag H. Rughani Shree R. P. Bhalodia College www.paragrughani.net/javame 38 Thank You