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) J2SE (Java2 Standard Edition) Business applications General applications (In this lecture, using this platform) 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 Maker NTT DoCoMo Adopt NTT DoCoMo company in Japan Foreign adopt None company LG Telecom, Motorola, Nokia, Siemens, Sam Sung, Sendo DoJa and MIDP Differences between DoJa and MIDP DoJa MIDP Few Classes Many Classes Easy to understand Difficult to understand than DoJa Simple User Inter Face structure Complex User Inter Face structure Simple data storage architecture Storage like a simple data base Able to ring sound 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 SDK, Standard Edition Version 1.3.0 or later CLDC Emulator J2ME Wireless SDK for the DoJa i-jade – popular emulator to run i-appli How to make i-appli Flow of development Write i-appli Program Compile %>javac filename Make jar archive Preverify %>preverify classfile Write jam and html Play i-appli with Your ke-tai!! %>jar –cfm classfile 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 Run (in emulator: i-jade) %java –jar i-jade.jar Preverify %javac –bootclasspath CLDCAPI –classpath DoJaAPI HelloWorld.java %preverify –classpath CLDCAPI:DoJaAPI –d HelloWorld Make jar archive %jar –cfM HelloWorld.jar HelloWorld.class HelloCanvas.class HelloWorld (Make jam file) Sample jam file AppName = My First i-appli PackageURL = HelloWorld.jar AppSize = 235 AppClass = HelloWorld LastModified = Sun, Jun 2002 16:45:54 HelloWorld (Make html file) If you have DoCoMo’s 503i, 504i phone, or above, you can visit this url and download this application My First i-appli 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/ ... type=“application/x-jam”> My First i-appli References J2ME Technologies (English) http:/ /java. sun.com /j2me/ Java Technologies... Emulator J2ME Wireless SDK for the DoJa i-jade – popular emulator to run i-appli How to make i-appli Flow of development Write i-appli Program Compile %>javac filename Make jar archive Preverify... (Compile) Compile Run (in emulator: i-jade) %java –jar i-jade.jar Preverify %javac –bootclasspath CLDCAPI –classpath DoJaAPI HelloWorld .java %preverify –classpath CLDCAPI:DoJaAPI