Upload
sheri
View
42
Download
4
Embed Size (px)
DESCRIPTION
JAVA TM 2 Micro Edition ( J2ME TM ) Technology for Creating Mobile Devices. 李凱雯 [email protected] 蔡文能 [email protected]. Introduction. J2EE. J2SE. J2ME. SmartCard. Everything Connected. Customizable,Personal Services. - PowerPoint PPT Presentation
Citation preview
JAVATM 2 Micro Edition (J2METM) Technology
for Creating Mobile Devices
Introduction
J2EE
J2SE
J2ME
SmartCard
Everything Connected
Customizable,Personal Services
kilo
CLDC:Connected Limited aaaa Device Configuration
CDC:Connected Device aaaaa Configuration
The Model of J2ME
What is Configuration?為 JVM 定義最小的能力和 library ,使 JVM足够小且能够在相同级别的所有設備上執行Configuration 所需的内存以及提供的處理能力在同一级别的設備上都很類似易於進行可相容性測試定義了兩种 Configuration:
Connected, Limited Device Configuration ( 連接的、有限設備的 Configuration)Connected Device Configuration ( 連接設備的 Configuration)
What is Profile?為一些 API ,作爲 Configuration 的補充,爲特定的縱向市場或設備類型提供服務爲某種設備領域提供特殊的服務,如蜂巢式電話或個人數位助理定義了一種 profile:
Mobile Information Device Profile (移動資訊設備 Profile )
Relationship between J2ME Configurations and J2SE
Java.* packages for J2ME
J2MESupports
• java.lang.*• java.io.*• java.util.*• Java.microedition.io.*
KVM (Kilo-bytes Virtual Machine on PalmOS)
Not support basic data types of float and double
J2ME Core Libraries
Core Lib SpecificationCLDC• Connected Limited Device Configuration• for devices with limited electronic and
computation power
CDC• Connected Device Configuration• eg Setup-Box
CLDC CDC
RAM >=32K >=256K
ROM >=128K >=512K
Power limited unlimited
Network slow fast
MIDP PDAP
Screen dpi
>=96*54(5184pixels)
>=20000pixels
CapacityRAM>=8KROM>=128K
RAM+ROM>=512K
Others Wireless
Foundation Profile Personal Profile
RMI Profile
MID : Mobile Information Device
PDA : Personal Digital Assistant
Profile
Profile
JAVA Application
Configuration Native APIs
OS
Device
Profile
MID PDAPersonal RMI
Foundation
CLDC CDC
Configuration
The Goal of KVM
Small, with a static memory in the range 40 Kilobytes to 80 Kilobytes.
Clean and highly portable
Modular and Customizable
Software of KVM
Download Kjava/KVM/KVMutil from sun.comJDK(J2SE)
j2sdk-1_3_0_02-win.exe
J2ME_CLDC/KVMj2me_cldc-1_0_2-fcs-winunix.zipj2me_cldc-1_0_2-fcs-kjava_overlay.zip
POSE(Palm OS Emulator)emulator-win.zip
Develop J2ME programs
Preverify before run your class file
*.java *.class *.class
*.prc
compile preverify
executable + wrapper.prc
Classfile verification in CLDC/KVM
Simple Example
HelloWorld.java
HelloWorld.javaNote that the HelloWorld extends Spotlet
private void paint(){ g.clearScreen(); g.drawString(“Hello, World”,60,80); exitButton.paint();
}public void penDown(int x,int y){ if(exitButton.pressed(x,y)) { System.exit(0); }}
}
import com.sun.kjava.*;public class HelloWorld extends Spotlet{
Button exitButton;static Graphics g=Graphics.getGraphics();public static void main(String[] args){ HelloWorld hw=new HelloWorld();
hw.register(NO_EVENT_OPTIONS);}public HelloWorld(){ exitButton=new Button(“exit”, 70, 120);
paint();}
Compile and Make PRC fileCompile
javac -g:none -classpath c:\j2me_cldc\bin\api\classes;. -bootclasspath c:\j2me_cldc\bin\api\classes HelloWorld.java
Preverify: output another class in .\outputpreverify –classpath c:\j2me_cldc\bin\api\classes;. HelloWorld
Make PRC Executable Filejava –classpath c:\j2me_cldc\bin\api\classes -bootclasspath c:\j2me_cldc\bin\api\classespalm.database.MakePalmApp –v HelloWorld
KJAVA API
Package:com.sun.kjava
The classes provided in this package are not part of the CLDC reference implementation
22 classes
Document of KJAVA API
Event handling
Spotlet:provides callbacks for event handling
JDK:inheritable delegation-based
KVM:inheritable
After V.1.1
Event handling in Spotlet
Spotlet Framework
HelloWorld.class
Bootstrap(wrapper.prc)
HelloWorld.prc
keyDown()penDown()/Up()penMove()KVM.prc
Events
Dispatch()
Event handling of KVM
MethodkeyDown
penDown 、 penUp and penMove
beamReceive
unknowEvent
Event handling of KVM (Cont.)
ModeNO_EVENT_OPTIONSWANT_SYSTEM_KEYS
ExampleEventHandling.java
kAWT
A simplified version of AWT for the KVM
why kAWT ?• the original com.sun.kjava classes included in
J2ME CLDC Beta1 and the older EA-Versions of KVM differ from the standard Java UI components in many aspects
Is implemented all lightweight similar to SWING
Event handling:delegation-based
kAWT(Cont.)
Both Spotlet and Frame can be used
LayoutBorderLayoutCardLayoutFlowLayoutGridLayoutGridBagLayout (not available in KAWT)
Software of KAWT
kawt_io_net_pdb.zipThe packages java.awt, java.awt.event, java.awt.image, de.kawt, de.kawt.shell, java.io and java.net.
kawt_io_net.zipThe compiled and preverified kAWT-classes in a jar file. Useful for compilation of own kAWT applications. Extension changed to zip because of download problems.
Example
Prog2_1.javaKawtDemo.java
Kjava 手機和傳統 WAP 手機的差別WAP(Wireless Application Protocol)是使移動通訊設備可靠地接入 Internet的國際標準。 WAP 手機是集移動電話與移動電腦於一身的通訊工具,它不僅具有普通手機的功能,而且還有收發電子郵件、傳真、瀏覽新聞、查看股市行情等功能。用用 K JavaK Java 解決解決開發周期大大縮短 , 方便移植到其他平臺 支援動態下載、升級 , 第三方開發者易於介入 K JavaK Java支持支持 ClientClient方式方式 access Internetaccess Internet 直接存取Internet 全部資訊 , 不同的 Client 存取各種各樣的文件 , 最高效率的 on-line 交易 , 存取本地存儲區,提高效率
集最新高科技于一身的Motorola A6288
J2ME 软件平台大陸第一款预装 J2ME 软件平台的手机 J2ME ( Java 2 Micro Edition )俗称 KJava
GPRS 网络A6288 是中国第一部支持 GPRS (General Packet Radio Service )网络的手机,即通用分组无线业务,它是一种允许信息通过移动电话网络传递的非语音增值服务,是现阶段普遍看好,也是最容易实现的移动设备高速上网技术。与传统的 GSM 相比,GPRS 拥有明显的优势
Internet
PC
TELECOM
HttpSocket ( Tcp/
Ip )
Motorola A6288:
1. 內置 J2Me 平臺 2. 支援收發 E-Mail 功能 3. 本身可以作爲無線Modem 給您的筆記本提供上網功能
Kjava 手機與傳統 WAP 聯接入 Internet 方式不同,省略掉了 WAP GateWay,
利用 K-Java Client 程式,可以通過 Http 或者 Socket 協定進行通訊,大大的提高了網路的傳輸速度。
K-Java
MOBILEPHONE
GSM/GPRS/3G
Telecom
K-Java
Internet
Http
/Socke
t(Tcp
/Ip
)
Motorola A6288 連接 Internet 方式
Jini and Java2 Technologies
Enterprise Edition Standard Edition Micro Edition No VM
Jini Networking Technology
Connected Device Configuration (CDC)
Connected Limited Device Config (CLDC)
RMI Profile JSR 66
Jini Device and Surrogate Architecture
Profiles….
MID
ProfileFoundation
Profile JSR 46
Personal ProfileJSR 62
Objectives for J2ME RMI Profile
J2ME interoperability with J2SE 1.2.x or higherTargeted at devices with
2.5 Mbytes minimum ROM1 Mbytes minimum RAMTCP/IP connectivityJ2ME CDC/Foundation Profile
Relationship to J2SE™ 1.3 APIsFull RMI call semanticsMarshalled object supportRMI wire protocol (JRMP)Export of remote objectsClient/server side DGCActivator interface and client side activation protocolRegistry interfaces and export of Registry remote object
Parts of J2SE RMI not includedRMI through firewalls via proxiesRMI multiplexing protocolImplementation model for “Activatable” Remote ObjectDeprecated methods, classes and interfacesSupport for JDK 1.1 stub/skeleton protocolsStub and skeleton compiler (rmic).
See java.sun.com/aboutJava/communityprocess/jsr/jsr_066_rmime.html
Referenceshttp://www.sun.com/software/communitysource/j2mehttp://webdev.apl.jhu.edu/~rbe/kvm/http://java.sun.com/products/cldc/http://www.sun.com/software/communitysource/j2me/cdc/http://www.billday.com/j2me/http://java.sun.com/products/j2mewtoolkit/