Sunteți pe pagina 1din 17

J2ME Programming

Hiroyuki Akimoto

Contents

J2ME and its Technologies i-appli Programming

Mobile Java

We can run Java program in our mobile device (such as mobile phone, PDA).

http://www.nokia.com/phones/9210/demo/intro_and_guide.html

about J2ME

Java2 is divided into three platforms

J2EE (Java2 Enterprise Edition)

Business applications. General applications (In this lecture, using this platform).

J2SE (Java2 Standard Edition)

J2ME (Java2 Micro Edition)

Small devices such as mobile phone, PDA, car navigation.

about J2ME

J2ME Platform needs configuration and profile.

CLDC (Connected Limited Device Configuration)


Mobile Phone Java use this configuration Deleted features


Floating Point Finalize Thread Group Java Native Interface (JNI) Reflection Weak References

J2SE
J2ME Floating Point

CLDC Thread Group

Profiles for mobile phone


DoJa MIDP (Mobile Information Device Profile) SUN J-PHONE au LG Telecom, Motorola, Nokia, Siemens, Sam Sung, Sendo

Maker NTT DoCoMo Adopt NTT DoCoMo company in Japan Foreign adopt None company

DoJa and MIDP

Differences between DoJa and MIDP


MIDP Many Classes

DoJa Few Classes

Easy to understand

Difficult to understand than DoJa

Simple User Inter Face structure Complex User Inter Face structure Simple data storage architecture Able to ring sound Storage like a simple data base Enable to ring sound (but companies overcome this problem to extend original API)

Detail of i-appli

DoCoMo 503, 504, 505,.. 900, FOMA Limited capacity 503i 10Kbyte 504i 30Kbyte 505,506 100K 900 300K Nonvolatile Memory Size 503i 10Kbyte 504i 100Kbyte 505i 300K 900 - 500-1M Applications can connect to only downloaded server

How to make i-appli

API

JavaTM 2 SDK, Standard Edition Version 1.3.0 or later CLDC J2ME Wireless SDK for the DoJa i-jade popular emulator to run i-appli

Emulator

How to make i-appli

Flow of development
Compile Preverify

Write i-appli Program

%>javac filename

%>preverify classfile

Make jar archive


%>jar cfm classfile

Write jam and html

Play i-appli with Your ke-tai!!

Form of i-appli program

Need to extend IApplication class.


import com.nttdocomo.ui.*; public class ClassName extends IApplication { // Called when this application is started public void start(){} // Called when this application is resumed public void resume(){} }

Hello World (Source Code)


import com.nttdocomo.ui.*; public class HelloWorld extends IApplication{ public void start(){ HelloCanvas canvas = new HelloCanvas(); Display.setCurrent(canvas); } public void resume(){} class HelloCanvas extends Canvas { public void paint(Graphics g){ g.drawString("Hello world",0,20); } }

Hello World (Compile)

Compile

%javac bootclasspath CLDCAPI classpath DoJaAPI HelloWorld.java %java jar i-jade.jar %preverify classpath CLDCAPI:DoJaAPI d . HelloWorld %jar cfM HelloWorld.jar HelloWorld.class HelloCanvas.class

Run (in emulator: i-jade)

Preverify

Make jar archive

HelloWorld (Make jam file)

Sample jam file


AppName = My First i-appli PackageURL = HelloWorld.jar AppSize = 235 AppClass = HelloWorld LastModified = Sun, 9 Jun 2002 16:45:54

HelloWorld (Make html file)

If you have DoCoMos 503i, 504i phone, or above, you can visit this url and download this application.

<html> <OBJECT declare id=iappli data=HelloWorld.jam type=application/x-jam> </OBJECT> <A ijam=#iappli href=index.htm>My First i-appli</A> </html>

References

J2ME Technologies (English) http://java.sun.com/j2me/ Java Technologies for WIRELESS (Japanese) http://jdc.sun.co.jp/wireless/ i-appli Specification (Japanese) http://www.nttdocomo.co.jp/p_s/imode/java/index.html i-jade (Japanese) http://www.zentek.com/i-JADE/ja/ Tutorial to make i-appli (Japanese) http://www.kajas.com/tutorial/index.html Amateur creaters i-appli search site (Japanese) http://www.kajas.com/

S-ar putea să vă placă și