java tm 2 micro edition (j2me tm ) technology for creating mobile devices 李凱雯...
TRANSCRIPT
![Page 1: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/1.jpg)
JAVATM 2 Micro Edition (J2METM) Technology
for Creating Mobile Devices
![Page 2: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/2.jpg)
Introduction
J2EE
J2SE
J2ME
SmartCard
![Page 3: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/3.jpg)
Everything Connected
![Page 4: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/4.jpg)
Customizable,Personal Services
![Page 5: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/5.jpg)
kilo
CLDC:Connected Limited aaaa Device Configuration
CDC:Connected Device aaaaa Configuration
![Page 6: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/6.jpg)
The Model of J2ME
![Page 7: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/7.jpg)
What is Configuration?為 JVM 定義最小的能力和 library ,使 JVM足够小且能够在相同级别的所有設備上執行Configuration 所需的内存以及提供的處理能力在同一级别的設備上都很類似易於進行可相容性測試定義了兩种 Configuration:
Connected, Limited Device Configuration ( 連接的、有限設備的 Configuration)Connected Device Configuration ( 連接設備的 Configuration)
![Page 8: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/8.jpg)
What is Profile?為一些 API ,作爲 Configuration 的補充,爲特定的縱向市場或設備類型提供服務爲某種設備領域提供特殊的服務,如蜂巢式電話或個人數位助理定義了一種 profile:
Mobile Information Device Profile (移動資訊設備 Profile )
![Page 9: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/9.jpg)
Relationship between J2ME Configurations and J2SE
![Page 10: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/10.jpg)
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
![Page 11: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/11.jpg)
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
![Page 12: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/12.jpg)
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
![Page 13: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/13.jpg)
Profile
JAVA Application
Configuration Native APIs
OS
Device
Profile
MID PDAPersonal RMI
Foundation
CLDC CDC
Configuration
![Page 14: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/14.jpg)
The Goal of KVM
Small, with a static memory in the range 40 Kilobytes to 80 Kilobytes.
Clean and highly portable
Modular and Customizable
![Page 15: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/15.jpg)
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
![Page 16: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/16.jpg)
![Page 17: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/17.jpg)
Develop J2ME programs
Preverify before run your class file
*.java *.class *.class
*.prc
compile preverify
executable + wrapper.prc
![Page 18: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/18.jpg)
Classfile verification in CLDC/KVM
![Page 19: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/19.jpg)
Simple Example
HelloWorld.java
![Page 20: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/20.jpg)
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();}
![Page 21: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/21.jpg)
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
![Page 22: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/22.jpg)
KJAVA API
Package:com.sun.kjava
The classes provided in this package are not part of the CLDC reference implementation
22 classes
![Page 23: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/23.jpg)
Document of KJAVA API
![Page 24: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/24.jpg)
![Page 25: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/25.jpg)
Event handling
Spotlet:provides callbacks for event handling
JDK:inheritable delegation-based
KVM:inheritable
After V.1.1
![Page 26: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/26.jpg)
Event handling in Spotlet
Spotlet Framework
HelloWorld.class
Bootstrap(wrapper.prc)
HelloWorld.prc
keyDown()penDown()/Up()penMove()KVM.prc
Events
Dispatch()
![Page 27: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/27.jpg)
Event handling of KVM
MethodkeyDown
penDown 、 penUp and penMove
beamReceive
unknowEvent
![Page 28: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/28.jpg)
Event handling of KVM (Cont.)
ModeNO_EVENT_OPTIONSWANT_SYSTEM_KEYS
ExampleEventHandling.java
![Page 29: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/29.jpg)
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
![Page 30: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/30.jpg)
kAWT(Cont.)
Both Spotlet and Frame can be used
LayoutBorderLayoutCardLayoutFlowLayoutGridLayoutGridBagLayout (not available in KAWT)
![Page 31: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/31.jpg)
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.
![Page 32: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/32.jpg)
Example
Prog2_1.javaKawtDemo.java
![Page 33: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/33.jpg)
Kjava 手機和傳統 WAP 手機的差別WAP(Wireless Application Protocol)是使移動通訊設備可靠地接入 Internet的國際標準。 WAP 手機是集移動電話與移動電腦於一身的通訊工具,它不僅具有普通手機的功能,而且還有收發電子郵件、傳真、瀏覽新聞、查看股市行情等功能。用用 K JavaK Java 解決解決開發周期大大縮短 , 方便移植到其他平臺 支援動態下載、升級 , 第三方開發者易於介入 K JavaK Java支持支持 ClientClient方式方式 access Internetaccess Internet 直接存取Internet 全部資訊 , 不同的 Client 存取各種各樣的文件 , 最高效率的 on-line 交易 , 存取本地存儲區,提高效率
![Page 34: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/34.jpg)
集最新高科技于一身的Motorola A6288
J2ME 软件平台大陸第一款预装 J2ME 软件平台的手机 J2ME ( Java 2 Micro Edition )俗称 KJava
GPRS 网络A6288 是中国第一部支持 GPRS (General Packet Radio Service )网络的手机,即通用分组无线业务,它是一种允许信息通过移动电话网络传递的非语音增值服务,是现阶段普遍看好,也是最容易实现的移动设备高速上网技术。与传统的 GSM 相比,GPRS 拥有明显的优势
![Page 35: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/35.jpg)
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 方式
![Page 36: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/36.jpg)
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
![Page 37: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/37.jpg)
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
![Page 38: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/38.jpg)
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
![Page 39: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/39.jpg)
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
![Page 40: JAVA TM 2 Micro Edition (J2ME TM ) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw](https://reader036.vdocuments.site/reader036/viewer/2022081421/56649ec05503460f94bcb179/html5/thumbnails/40.jpg)
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/