Mobile Phone Development

Colin P. Fahey


<<< BACK TO MOBILE DEVELOPMENT


SUN'S "J2ME WIRELESS TOOLKIT
VERSION 1.0.4_01"

INTRODUCTION

Sun offers a convenient development environment for building and packaging J2ME wireless applications: "Java 2 Platform Micro Edition (J2ME) Wireless Toolkit version 1.0.4_01". (CAUTION: You need to download the Java 2 SDK 1.4 as described in an earlier section to use this toolkit. Do this now if you don't already have this version of the Java 2 SDK.) Go to the following site to download: http://java.sun.com/products/j2mewtoolkit/

**************** CAUTION!!! **************** Do NOT click on the link "2.0 Beta 1 English" (currently the top download option) if you are doing Motorola T720 development -- because this version has some MIDP-2.0 stuff, and getting around this may be a headache. FIGURE: Do **NOT** download this version! ("2.0 Beta 1 English"). (I tried this version, and I eventually got code to compile with lots of messy settings changes, but after all the effort I got a security exception when I tried to execute. Don't bother!) **************** CAUTION!!! ****************

Download the "1.0.4_01 English" version. Here is what the download page looks like:
FIGURE: Sun's "J2ME Wireless Toolkit Version 1.0.4_01" download page.
FIGURE: Sun's "J2ME Wireless Toolkit Version 1.0.4_01" FTP site list. This will download the following file: "j2me_wireless_toolkit-1_0_4_01-bin-win.exe" Execute this program to install on your system.

J2ME WIRELESS TOOLKIT : LAUNCH TOOLBAR

Once the toolkit is installed, you can launch it from the "Start" menu system:
FIGURE: Starting the toolbar application. You can also access MIDP-1.0 documentation via the "Documentation" item in this start menu.
FIGURE: "J2ME Wireless Toolkit Version 1.0.4_01" Documentation.

J2ME WIRELESS TOOLKIT : CREATE PROJECT AND BUILD


FIGURE: Toolbar is ready. Click "New Project..." to create a new project.
FIGURE: New Project: Type in project name (becomes JAR name and name of new project directory), and type in MIDlet class name (class derived from MIDlet, essentially the main class of your application).
FIGURE: Toolbar: Project created. Notice that the console tells you where to put your *.java source files, etc. (e.g., "c:\WTK104\apps\sbj\src", etc)
FIGURE: Click on "Settings..." on the toolbar to get this project settings menu. Disregard the "MIDlet-Jar-Size" field (with value "100" bytes) for now. We will eventually cause the correct value to get set.
FIGURE: Click on the MIDlets tab of the project settings dialog. Click on the only row in the table ("MIDlet-1") to highlight and select it. Then click the "Edit" button.
FIGURE: Clear the "Icon" field if you do not have a *.PNG file to put in your JAR file.
FIGURE: Do the following: (1) Project --> Clean : Removes all *.class files. (2) Build : Builds all *.class files and preverifies. (3) Project --> Package --> Create Package : Produces *.JAR and *.JAD When you do these three steps, the resulting *.JAR and *.JAD are immediately ready for execution in the local emulator, or for immediate deployment on your WWW site for others to download Over The Air (OTA). The *.JAR size field in the *.JAD file will be correct. Don't forget to do step (3) every single time you rebuild! Now you can test by hitting the "Run" button.
FIGURE: Hitting "Run" for the project reads the JAD in to the emulator. You can select the specific MIDlet to launch (typically just one). Just copy the *.JAR and *.JAD files from the specified locations (reported by the toolbar's console window during a build of the project), such as: (From the console window:)

Wrote c:\WTK104\apps\sbj\bin\sbj.jar Wrote c:\WTK104\apps\sbj\bin\sbj.jad

Put these files directly on to your WWW site without modification, and it should work fine. Here is what I saw on my cell phone after downloading this compiled application Over The Air (OTA):
FIGURE: Sam's Blackjack Trainer (sbj.jar) running on my phone.


<<< BACK TO MOBILE DEVELOPMENT



CONTACT INFORMATION

Colin P. Fahey cpfahey@earthlink.net

http://www.colinfahey.com