1 / 40

JAVA TM 2 Micro Edition ( J2ME TM ) Technology for Creating Mobile Devices

JAVA TM 2 Micro Edition ( J2ME TM ) Technology for Creating Mobile Devices. 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw. Introduction. J2EE. J2SE. J2ME. SmartCard. Everything Connected. Customizable,Personal Services .

sheri
Download Presentation

JAVA TM 2 Micro Edition ( J2ME TM ) Technology for Creating Mobile Devices

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. JAVATM 2 Micro Edition (J2METM) Technology for Creating Mobile Devices 李凱雯 kaiwen@java.csie.nctu.edu.tw 蔡文能 tsaiwn@csie.nctu.edu.tw

  2. Introduction J2EE J2SE J2ME SmartCard

  3. Everything Connected

  4. Customizable,Personal Services

  5. CLDC:Connected Limitedaaaa Device Configuration CDC:Connected Deviceaaaaa Configuration kilo

  6. The Model of J2ME

  7. What is Configuration? • 為JVM 定義最小的能力和library,使JVM足够小且能够在相同级别的所有設備上執行 • Configuration所需的内存以及提供的處理能力在同一级别的設備上都很類似 • 易於進行可相容性測試 • 定義了兩种Configuration: • Connected, Limited Device Configuration (連接的、有限設備的Configuration) • Connected Device Configuration (連接設備的Configuration)

  8. What is Profile? • 為一些API,作爲Configuration的補充,爲特定的縱向市場或設備類型提供服務 • 爲某種設備領域提供特殊的服務,如蜂巢式電話或個人數位助理 • 定義了一種profile: • Mobile Information Device Profile (移動資訊設備Profile)

  9. Relationship between J2ME Configurations and J2SE

  10. Java.* packages for J2ME • J2ME • Supports • 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

  11. J2ME Core Libraries • Core Lib Specification • CLDC • Connected Limited Device Configuration • for devices with limited electronic and computation power • CDC • Connected Device Configuration • eg Setup-Box

  12. Foundation Profile Personal Profile RMI Profile Profile MID : Mobile Information Device PDA : Personal Digital Assistant

  13. JAVA Application Profile Configuration Native APIs OS Device Profile RMI Personal MID PDA Foundation CLDC CDC Configuration

  14. The Goal of KVM • Small, with a static memory in the range 40 Kilobytes to 80 Kilobytes. • Clean and highly portable • Modular and Customizable

  15. Software of KVM • Download Kjava/KVM/KVMutil from sun.com • JDK(J2SE) • j2sdk-1_3_0_02-win.exe • J2ME_CLDC/KVM • j2me_cldc-1_0_2-fcs-winunix.zip • j2me_cldc-1_0_2-fcs-kjava_overlay.zip • POSE(Palm OS Emulator) • emulator-win.zip

  16. Develop J2ME programs • Preverify before run your class file *.java compile *.class preverify *.class *.prc + wrapper.prc executable

  17. Classfile verification in CLDC/KVM

  18. Simple Example • HelloWorld.java

  19. HelloWorld.java 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(); } • Note 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); } }}

  20. Compile and Make PRC file • Compile • javac -g:none -classpath c:\j2me_cldc\bin\api\classes;. -bootclasspath c:\j2me_cldc\bin\api\classes HelloWorld.java • Preverify: output another class in .\output • preverify –classpath c:\j2me_cldc\bin\api\classes;. HelloWorld • Make PRC Executable File • java –classpath c:\j2me_cldc\bin\api\classes -bootclasspath c:\j2me_cldc\bin\api\classespalm.database.MakePalmApp –v HelloWorld

  21. KJAVA API • Package:com.sun.kjava • The classes provided in this package are not part of the CLDC reference implementation • 22 classes

  22. Document of KJAVA API

  23. Event handling • Spotlet:provides callbacks for event handling • JDK:inheritable delegation-based • KVM:inheritable After V.1.1

  24. Event handling in Spotlet HelloWorld.prc Bootstrap(wrapper.prc) • Spotlet Framework Events HelloWorld.class Dispatch() keyDown()penDown()/Up()penMove() KVM.prc

  25. Event handling of KVM • Method • keyDown • penDown、penUp andpenMove • beamReceive • unknowEvent

  26. Event handling of KVM (Cont.) • Mode • NO_EVENT_OPTIONS • WANT_SYSTEM_KEYS • Example • EventHandling.java

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

  28. kAWT(Cont.) • Both Spotlet and Frame can be used • Layout • BorderLayout • CardLayout • FlowLayout • GridLayout • GridBagLayout (not available in KAWT)

  29. Software of KAWT • kawt_io_net_pdb.zip • The packages java.awt, java.awt.event, java.awt.image, de.kawt, de.kawt.shell, java.io and java.net. • kawt_io_net.zip • The compiled and preverified kAWT-classes in a jar file. Useful for compilation of own kAWT applications. Extension changed to zip because of download problems.

  30. Example • Prog2_1.java • KawtDemo.java

  31. Kjava手機和傳統WAP手機的差別 • WAP(Wireless Application Protocol)是使移動通訊設備可靠地接入Internet的國際標準。 • WAP手機是集移動電話與移動電腦於一身的通訊工具,它不僅具有普通手機的功能,而且還有收發電子郵件、傳真、瀏覽新聞、查看股市行情等功能。 • 用K Java解決開發周期大大縮短,方便移植到其他平臺 支援動態下載、升級, 第三方開發者易於介入 • K Java支持Client方式access Internet直接存取Internet全部資訊,不同的Client存取各種各樣的文件,最高效率的on-line交易,存取本地存儲區,提高效率

  32. 集最新高科技于一身的Motorola A6288 • J2ME软件平台 • 大陸第一款预装J2ME软件平台的手机J2ME(Java 2 Micro Edition)俗称KJava • GPRS网络 • A6288是中国第一部支持GPRS (General Packet Radio Service)网络的手机,即通用分组无线业务,它是一种允许信息通过移动电话网络传递的非语音增值服务,是现阶段普遍看好,也是最容易实现的移动设备高速上网技术。与传统的GSM相比,GPRS拥有明显的优势

  33. Motorola A6288連接Internet方式 K-Java MOBILEPHONE TELECOM Internet K-Java Telecom Internet GSM/GPRS/3G Http Socket(Tcp/Ip) Http/Socket(Tcp/Ip) Motorola A6288: 1.內置J2Me平臺 2. 支援收發E-Mail功能 3. 本身可以作爲無線Modem給您的筆記本提供上網功能 Kjava手機與傳統WAP聯接入Internet方式不同,省略掉了WAP GateWay, 利用K-Java Client程式,可以通過Http或者Socket協定進行通訊,大大的提高了網路的傳輸速度。 PC

  34. Jini and Java2 Technologies Jini Networking Technology Jini Device and Surrogate Architecture RMI Profile JSR 66 Personal Profile JSR 62 Profiles…. MID Profile Foundation Profile JSR 46 Connected Device Configuration (CDC) Connected Limited Device Config (CLDC) Enterprise Edition Standard Edition Micro Edition No VM

  35. J2ME interoperability with J2SE 1.2.x or higher Targeted at devices with 2.5 Mbytes minimum ROM 1 Mbytes minimum RAM TCP/IP connectivity J2ME CDC/Foundation Profile Objectives for J2ME RMI Profile

  36. Relationship to J2SE™ 1.3 APIs • Full RMI call semantics • Marshalled object support • RMI wire protocol (JRMP) • Export of remote objects • Client/server side DGC • Activator interface and client side activation protocol • Registry interfaces and export of Registry remote object

  37. RMI through firewalls via proxies RMI multiplexing protocol Implementation model for “Activatable” Remote Object Deprecated methods, classes and interfaces Support for JDK 1.1 stub/skeleton protocols Stub and skeleton compiler (rmic). See java.sun.com/aboutJava/communityprocess/jsr/jsr_066_rmime.html Parts of J2SE RMI not included

  38. References • http://www.sun.com/software/communitysource/j2me • http://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/

More Related