J2ME software development for cellular phones
(2002)
Colin Fahey
moto_t720_open_lightanddark02.jpg
Motorola T720 cellular phone, shown opened

1. Warning

This document is obsolete!  The information in this document might have been valid and useful in the year 2002, but many things have changed in subsequent years!  This document should now only be regarded as an interesting historical record of the year 2002.  Do not rely on any information or advice in this document.  All technical information in this document is very obsolete. 

Downloading self-created software, self-created images, and self-created telephone alert melodies (i.e., "ring tones"), was relatively rare and difficult in the year 2002.  Sadly, six years later, some cellular phone service providers (including Apple, which provides the exclusive software and "ring tone" portal for the iPhone) still impose restrictions on downloading software, images, and music, because cellular phone service providers enjoyed extremely large financial profits by controlling these types of downloads. 

Fortunately, cellular phones such as those featuring the "Android" software platform, will forever end the ability of companies to create and exploit closed markets for such uses of cellular phones.  Although consumers willingly purchased cellular phone service plans that included very high costs for downloading software, images, and music, this is because of the limited number of cellular phone service options available. 

The economic dynamics that have enabled certain companies to grow to dominate the market should not be interpreted as implicit strong approval by the consumers.  As companies start to dominate, and then make it difficult or impossible for competitors to enter the market, the dominating companies can offer products that combine high positive value (e.g., the ability to communicate from anywhere) with high negative value (e.g., high prices for desirable software, images, and music, all of which would otherwise be freely available; thus, the service adds negative value).  No consumer is forced to purchase a cellular phone, but there is no doubt that the dominant cellular phone service providers have gradually created conditions that can not be considered a "free market".  Therefore, the cellular phone service market has been economically "inefficient" and has been an undue burden on consumers. 

Hopefully, requirements that cellular phone service radio frequencies be available to competing services will restore normal market values to data transfer, such that cellular phone service providers are again reduced to mere carriers of data (i.e., only providing bandwidth) rather than information or entertainment providers! 

The business of transporting data must be separated from the business of selling data, otherwise there will be an incentive for the data transportation business to block competitors from selling data through the same data transportation channel. 

The video game console market suffers from the same problem.  The manufacturers of video game console hardware are in the business of creating devices that can display video games, but those same companies also have exclusive control of the transfer of software to those video game consoles.  Therefore, there is an incentive for the video game console manufacturers to block competitors from selling software for the video game consoles.  If a video game console hardware manufacturer focused on designing and manufacturing hardware that could be sold at a profit (instead of at a significant loss, as with the X-Box and PlayStation and Nintendo video game consoles), then the video game market would thrive, and the quality of the best video games would dramatically improve, and the cost of video games would collapse. 

2. Topic index

(1)
J2ME development tools
(2)
Simple J2ME program
(3)
Complex J2ME program
(4)
Sun "wireless toolkit"
(5)
Offering software on an Internet site
(6)
Downloading software from an Internet site
(7)
Download error messages and installation error messages
(8)
Creating, offering, and downloading "ring tones"
(9)
Creating, offering, and downloading images
(10)
AT&T cellular phone configuration settings (for the network)
(11)
Links to other cellular phone resources
(12)
J2ME versus BREW

3. J2ME development tools

This section describes how to download development tools that can be used to compile J2ME source code in to class files suitable for mobile devices.  Note that the Sun "J2ME Wireless Toolkit", discussed in a later section of this article, requires downloading the Java SDK described in this section. 

3.1 JDK 1.4 (or later)

This means you need the conventional Java 2 SDK from Sun.  I downloaded and used version 1.4 via the following link:
http://java.sun.com/j2se/1.4/download.html
Here is what the download page looks like:
java2sdk_download_page.jpg
Start the installation program.  Install to the default location ( c:\j2sdk1.4.0_03 ) unless you are able to solve path problems that may arise. 

3.2 Connected Limited Device Configuration (CLDC)

I won't pretend to know what this is, but I simply downloaded it from the Sun web site.
http://wwws.sun.com/software/communitysource/j2me/cldc/download.html
Here is what the CLDC main download web page looks like:
cldc_download_page.jpg
Only 1.0.3 was available at the time I visited.
In order to download this, I needed to register with Sun web site.  I created the following profile:
Username:        anon***anon
Password:        nospamplease
Favorite color:  blue
Full name:       Prof. Anon Nospamplease
I downloaded the following file:
j2me_cldc-1_0_3-fcs-src-b17-winunix-14_sep_2001.zip
I unzipped to the following directory:
C:\j2me
I renamed the "cldc-1_0_3-fcs" directory to simply:
cldc ( i.e., the full path is c:\j2me\cldc )

3.3 Mobile Information Device Profile (MIDP)

I won't pretend to know what this is either, but I simply downloaded it from the Sun web site.
http://java.sun.com/products/midp/
Here's what the MIDP main download web page looks like:
midp_download_page.jpg
I downloaded the following file:
j2me_midp-1_0_3-fcs-src-b26-win-19_sep_2001.zip
I unzipped to the following directory:
C:\j2me
I renamed the "midp-1_0_3-fcs" directory to simply:
midp ( i.e., the full path is c:\j2me\midp )

3.4 Configuring tools

3.4.1 Establish paths

Add the following lines to your AUTOEXEC.BAT file:
REM ---- Java Support ----
SET MIDP_HOME=C:\j2me\midp
SET PATH=%PATH%;c:\j2sdk1.4.0_03\BIN;
PATH=C:\WINDOWS;C:\WINDOWS\COMMAND;C:\j2sdk1.4.0_03\BIN;C:\j2me\midp\bin;%PATH%
Then force these variables to be reloaded by running the batch file:
cmd_prompt_autoexec_bat.jpg
c:\>  autoexec.bat
You can also set up these same variables using the Windows environment variable control panel.

Notice that I chose to specify explicit directory paths to my current version of the Java 2 SDK.  Therefore, if I upgrade, then I must modify the AUTOEXEC.BAT file to specify the new directories. 

3.4.2 Check the Jave 2 SDK binaries

Once the settings above take effect, you should be able to run the Java tool programs from the command prompt without specifying the complete path to the tool programs. 

The following command will start the cellular phone device emulator: 
cmd_prompt_midp.jpg
c:\>  midp
The following image shows the cellular phone device emulator: 
java_midp_launch.jpg

4. Simple J2ME program

4.1 Write Java code

Using any text editor, a person can type in code, such as for this HelloMIDlet.java source code file:
file_image_hellomidlet_java.jpg
Here is the code in plain text format:
// File: HelloMIDlet.java
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class  HelloMIDlet
extends       MIDlet
implements    CommandListener
{
    private Command exitCommand;
    private Display display;
    private TextBox t = null;

    public HelloMIDlet()
    {
        display = Display.getDisplay( this );
        exitCommand = new Command( "Exit", Command.EXIT, 2 );
        t = new TextBox
        (
            "Hello MIDlet",
            "Test string",
            256, 0
        );
        t.addCommand( exitCommand );
        t.setCommandListener( this );
    }

    public void startApp()
    {
        display.setCurrent( t );
    }

    public void pauseApp()
    {
    }

    public void destroyApp( boolean unconditional )
    {
    }

    public void commandAction( Command c, Displayable s )
    {
        if (c == exitCommand)
        {
            destroyApp( false );
            notifyDestroyed();
        }
    }
}

4.2 Compile *.java code to *.class

cd  c:\HelloMIDlet
Caution: The following command must be on a single line, but has been expanded to several lines of text only for clarity.
(Current directory: C:\HelloMIDlet)
javac
    -target 1.1
    -d .\
    -bootclasspath c:\j2me\midp\classes
    HelloMIDlet.java
cmd_prompt_javac.jpg
Note: The "-target 1.1" is necessary to avoid an error in the future "preverify" stage.  Apparently this has something to do with a problem with MIDP 1.0.3 support in JDK 1.4. 

4.3 Preverify to generate a new *.class file

cmd_prompt_preverify.jpg
(Current directory: C:\HelloMIDlet)
preverify  -classpath  c:\j2me\midp\classes;.  HelloMIDlet
This generates a new *.class file in a new subdirectory called "output" (by default).

4.4 Test the new *.class file

cmd_prompt_midp_midlet.jpg
(Current directory: C:\HelloMIDlet)
midp  -classpath  c:\j2me\midp\classes;.\output  HelloMIDlet
This starts the phone emulator, indicating that the new "output" directory contains some of the necessary *.class files.
The following image shows the expected result.
java_midp_hellomidlet.jpg

4.5 Create a new text file, "manifest.mf", and edit the file

A "manifest.mf" file is essential to getting an actual cellular phone to interpret the contents of a *.jar file.  If a proper "manifest.mf" file is not included within the *.jar file, then the cellular phone might successfully download the *.jar file, but might fail to interpret the downloaded file, possibly reporting an error such as "Unsupported Content Type". 
The following is an example of a simple "manifest.mf" file.
file_image_manifest_mf.jpg
Here is the "manifest.mf" file as plain text: 
MIDlet-1: My_Description,, HelloMIDlet
MIDlet-Name: My_Midlet_Suite
MIDlet-Vendor: Colin Fahey, Inc.
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
Notice that the CLDC and MIDP versions are specified in this file.  Be very cautious and conservative when editing the various fields in this file.  If you get "File Corrupt" errors, then try eliminating all fields that are not shown in this example.  Also, put the fields in the order in which they appear in the example.  Also, shorten each field value as much as you can, and keep the characters limited to simple letters, digits, periods, and dashes.  Some cellular phone services, and cellular phones, can tolerate more variation of field ordering and field contents. 
Caution: 

When the "jar" program is used to create a *.jar file, and the "manifest.mf" file is specified as the manifest file, the "jar" program reads the manifest file and might add more fields as it creates a file called "MANIFEST.MF" within the output *.jar file.  Therefore, if the "MANIFEST.MF" file is extracted from a *.jar file, and is then compared with the original "manifest.mf" file specified during the creation of the *.jar, the two files might be different, with the "MANIFEST.MF" file containing several more fields than the original "manifest.mf" file. 

Do not extract a "MANIFEST.MF" file from a *.jar file and attempt to form a new *.jar file using that manifest file.  If you extract a "MANIFEST.MF" file from a *.jar file, then be sure to eliminate all fields except for those shown in the example "manifest.mf" file shown above. 
Note:

Icons for programs apparently do not appear on the Motorola T720 phone.  This is why I did not describe my midlet with an icon.  However, the following shows how to set an icon for the program within the manifest file: 

MIDlet-1: My_Description, /icon.png, HelloMIDlet 

When developing for cellular phones that do display icons for applications, specify the icon filename, and add the icon image file itself to the *.jar file by specifying the file name among the file names of files to be added to the *.jar file. 

4.6 Put the "manifest.mf" file and *.class file in to a *.jar file

The following command creates a *.jar file.  The *.jar file will contain the specified manifest.mf file, and will contain the *.class files found in the specified directory.
cmd_prompt_jar.jpg
Current directory: C:\HelloMIDlet
jar  cfm  hi.jar  manifest.mf  -C .\output  HelloMIDlet.class
Complex hypothetical example of creating a *.jar file
Suppose an icon image file (e.g., "icon.png") is to appear in a *.jar file as "/icon.png".  (Note: Program icons do not appear on the Motorola T720 cellular phone, but do appear on other cellular phone types, and do appear in the MIDP emulator.) 

Suppose there is a directory named "images" with image files (*.png format).  Suppose this directory, and all of the images contained in the directory, should be accessible to the Java program by the relative directory /images (such that an image "a.png" would be accessible using the path "/images/a.png"). 

Suppose all of the *.class files produced by the preverify command are contained in a directory named "verified".  For example, the verified version of the main class, "MyApp.class", would be in the "verified" folder, along with the other classes of the program.  All of these classes are to be accessible in the root directory of the *.jar file. 

The following command will create a *.jar file that achieves the various goals specified in the previous paragraphs.  Caution: the command has been expanded to several lines of text here only for clarity.  When entering the command at a command prompt, the command must not contain line breaks; otherwise the command interpreter will interpret the entered text as multiple independent commands. 

jar
    cfmv             [Create JAR, Specify JAR Name, Add manifest.mf, Verbose]
    MyApp.jar        [Name of output JAR file]
    manifest.mf      [The manifest.mf file]
    icon.png         [Optional icon, specified by JAD as "/icon.png"]
    images           [Directory to add to JAR as "/images"]
    -C .\verified .
The final part of the command is difficult to understand.  It has the following meaning:  "Change the current working directory to .\verified, and then put all *.class files found in the relative directory '.' (namely all *.class files in the current working directory) in to the *.jar file."  Because the directory had been changed before specifying the path of the classes to put in the *.jar file, the local path will not appear in the relative path when the files are placed in to the *.jar file. 

For example, suppose the verified classes are in the following directory: 

C:\MyApp\verified 

Suppose there are class files such as the following: 

C:\MyApp\verified\w.class 

Then specifying "-C .\verified ." in the command to create the *.jar file, starting from a current directory of "C:\MyApp", will result in "w.class" being put in the root directory of the *.jar file. </e>

Warning: When the "-C" option is specified, it changes the current working directory at that point of processing the overall sequence of command parameters to the jar command.  Therefore, the jar command might complain that it cannot find other files mentioned in command parameters beyond the "-C" option.  If this happens, simply move the "-C .\verified ." to be the final parameters of the overall command. 

The following shows verbose output of the jar command. 
added manifest
adding: icon.png(in = 449) (out= 454)(deflated -1%)
adding: images/(in = 0) (out= 0)(stored 0%)
adding: images/a.png(in = 2463) (out= 2223)(deflated 9%)
adding: images/b.png(in = 1322) (out= 579)(deflated 56%)
adding: images/c.png(in = 3433) (out= 2874)(deflated 16%)
adding: images/d.png(in = 1524) (out= 801)(deflated 47%)
adding: w.class(in = 2570) (out= 1356)(deflated 47%)
adding: MyApplication.class(in = 4714) (out= 2169)(deflated 53%)
adding: x.class(in = 3239) (out= 1429)(deflated 55%)
adding: y.class(in = 14205) (out= 6481)(deflated 54%)
adding: z.class(in = 9448) (out= 5135)(deflated 45%)

4.7 Create and edit a new *.jad file

A *.jad file is necessary so that the cellular phone can describe a computer program to a person before the person decides to download the program.  The *.jad file also provides some indirection from the *.jar itself. 
file_image_hi_jad.jpg
An example *.jad file, describing a *.jar file
Here is the example hi.jad file in plain text format:
MIDlet-1: My_Description,, HelloMIDlet
MIDlet-Jar-Size: 1283
MIDlet-Jar-URL: http://www.colinfahey.com/hi.jar
MIDlet-Name: My_Midlet_Suite
MIDlet-Vendor: Colin Fahey, Inc.
MIDlet-Version: 1.0
There are programs which can generate the *.jad file, which makes it easier to update the "MIDlet-Jar-Size:" field each time the *.jar file is changed (and its size changes).  If you search the Internet you will find useful J2ME programs. 

If the size field doesn't specify the exact byte total of the *.jar file, then the following error might appear after a successful download to a cellular phone: "Download Failed" (download failed). 

For the Motorola T720 cellular phone, the following error message might be used to inidcate invalid fields in the *.jad file, or possibly invalid fields in the generated MANIFEST.MF file within the *.jar file: "Failed: File Corrupt" (failed: file corrupt). 
Note: If the *.jar file is in the same directory as the corresponding *.jad file on an Internet web server, then the *.jad file can simply indicate the file name of the *.jar file, without specifying a full URL, as in the following example: 

MIDlet-Jar-URL: hi.jar 

When downloading these files from an Apache Internet web server to a Motorola T720 cellular phone, it is acceptable to not include the full URL.  However, when downloading these files from a Yahoo! Internet web server to a Motorola T720 cellular phone, the attempt to download will fail, unless a full URL path to the *.jar file is specified within the *.jad file, as in the following example: 

MIDlet-Jar-URL: http://www.colinfahey.com/hi.jar 

I do not know the reason for this problem, and I know that this problem does not affect other cellular phones (or cellular phone service providers).  Having to specify the full URL for the *.jar file within the *.jad file is obviously inconvenient, because moving the files to different locations on a server would require changing the information in all *.jad files.  However, specifying the full URL might make the *.jad more reliable for certain cellular phones and certain cellular phone service providers. 

4.8 Test the *.jar file and the *.jad file by executing the program

The following executes the class found in the *.jar file, described by the *.jad file. 
cmd_prompt_midp_jar_jad.jpg
(Current directory: C:\HelloMIDlet)
midp  -classpath c:\j2me\midp\classes;.\hi.jar  -descriptor hi.jad

4.9 References for J2ME, MIDP, CLDC development

Much of what I presented here can be found on many other Internet sites.  However, I corrected some errors found on other Internet sites, and added missing details, and presented the complete experience of someone trying to do this stuff.  Here are very informative links that helped me get started: 
http://wireless.java.sun.com/midp/articles/getstart
http://wireless.java.sun.com/midp/articles/setup

5. Complex J2ME program

5.1 Introduction

The simple program presented in the previous section of this document only has a single source code file, and the program does nearly nothing and thus is not a good example of cellular phone programming. 

My friend Sam Robertson wrote an interesting J2ME program that teaches a person to play the card game "Blackjack" (also called "21").  A player is presented with a "dealer card", and the player's pair of cards, and the player must decide what to do: "stay", "hit", "double-down", or "split". 

This program has six source code files.  The program responds to user input, and does simple drawing and text updates. 
sbj_screen_on_phone.jpg

5.2 Source code

Click on the following link to get the source code, and the *.jad file, "manifest.mf" file, and a batch file, all in one convenient ZIP file.
sbj.zip
Source code contained in a ZIP file
6090 bytes
MD5: bf3922035b7a4eef24e107d03b7524c9
Extract to an arbitrary directory, but if you extract to "c:\" under Windows, the following example discussion will be even closer to your actual situation.
sbj_directory_files.jpg
Extracting sbj.zip to "c:\" creates the directory "c:\sbj"

5.3 Manifest file

File: "manifest.mf":
MIDlet-1: My_Description,, SBJ_MidletT
MIDlet-Name: SBJ_MidletT
MIDlet-Vendor: Sam Robertson
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0

5.4 The batch file to build the program

The following batch file is rough, but it serves as an illustration of how you might get started with writing your own batch file to build your J2ME program.  This example batch file does the following:
(1) Delete the directory containing the old *.class files; 
(2) Delete the directory containing the old verified *.class files; 
(3) Make a "classes" output directory; 
(4) Compile all *.java sources in to *.class files, with output going to the "classes" directory. 
(5) Make a "verified" output directory; 
(6) Preverify all classes in the "classes" directory, and put the verified classes in the "verified" directory. 
(7) Create a *.jar file, and add the mainfest file, and all classes in the "verified" directory; 
*(8) Test the program via the preverified classes directly; 
*(9) Test the program via the *.jar and *.jad files; 

(*...These steps are disabled (by commenting) in my batch file.) 
sbj_build_sbj_bat_file.jpg
The batch file "build_sbj.bat" for building the program
Here is the same file ("build_sbj.bat") in plain text format:
rmdir /S /Q classes
rmdir /S /Q verified
del /F /Q  *.jar

mkdir classes

javac  -g:none  -target 1.1  -d .\classes  -bootclasspath c:\j2me\midp\classes  *.java

mkdir verified

preverify  -classpath c:\j2me\midp\classes;.\classes  -d .\verified  .\classes

jar  cvfm sbj. jar manifest.mf  -C  .\verified  .

REM  midp  -classpath c:\j2me\midp\classes;.\verified  SBJ_MidletT
REM  midp  -classpath c:\j2me\midp\classes;.\sbj.jar  -descriptor sbj.jad
REM  Finished

5.5 Building from the command prompt

Here is the result of running the "build_sbj.bat" batch file at the command line:
sbj_build_command_prompt.jpg
Executing the "build_sbj.bat" batch file
Note that the warning messages for the "rmdir" and "del" operations simply indicate that there is nothing to remove. 

You can see the new directories (i.e., "classes" and "verified") and the new *.jar file that resulted from running the batch file:
sbj_new_files_after_build.jpg
Source code files and new generated file

5.6 *.jad file

To deploy the sbj.jar file, we need to create and edit the sbj.jad file to have the correct *.jar size in the appropriate field:
File: sbj.jad
MIDlet-1: SBJ_MidletT, , SBJ_MidletT
MIDlet-Jar-Size: 7257
MIDlet-Jar-URL: sbj.jar
MIDlet-Name: Sam Blackjack Trainer
MIDlet-Vendor: Sam Robertson
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
A person might need to add the complete URL to the *.jar file when the *.jad file is put on an Internet site -- but I discovered (by an experiment) that I was able to avoid mentioning the full URL (i.e., I only specified the *.jar file name by itself).  However, putting in the complete URL, but I wanted to let you know what I observed.

5.7 Summary

Having multiple source files in your project is common, and in this section we gave a crude illustration of building multiple classes, followed by packaging and execution. 

Please see the following section regarding using Sun Wireless Toolkit, which makes building applications much easier. 

6. Sun "Wireless Toolkit (version 1.0.4_01)"

6.1 Introduction

Sun offers a convenient development environment for building and packaging J2ME programs: "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 Internet site to download the toolkit: 

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. 
j2me_wireless_toolkit_2_0_download_page.jpg
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! 
Download the "1.0.4_01 English" version.  Here is what the download page looks like: 
j2me_wireless_toolkit_1_0_4_01_download_page.jpg
The Sun J2ME Wireless Toolkit (version 1.0.4_01) download page
j2me_wireless_toolkit_1_0_4_01_download_page2.jpg
The Sun 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.

6.2 J2ME Wireless Toolkit : launch toolbar

After the toolkit is installed, you can launch it from the "Start" (start) menu system:
j2me_wireless_toolkit_1_0_4_ktoolbar.jpg
Starting the toolbar program
You can also access MIDP-1.0 documentation via the "Documentation" item in this Start (start) menu.
j2me_wireless_toolkit_2_0_wtk20_docs_api_index_html.jpg
J2ME Wireless Toolkit (version 1.0.4_01) documentation

6.3 J2ME Wireless Toolkit : create project and build

j2me_wireless_toolkit_1_4_ktoolbar_window.jpg
The toolbar is ready.  Click "New Project..." to create a new project.
j2me_wireless_toolkit_1_4_ktoolbar_new_project.jpg
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). 
j2me_wireless_toolkit_1_4_ktoolbar_project_created.jpg
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) 
j2me_wireless_toolkit_1_4_ktoolbar_project_settings.jpg
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. 
j2me_wireless_toolkit_1_4_ktoolbar_project_midlet_settings.jpg
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. 
j2me_wireless_toolkit_1_4_ktoolbar_project_no_icon.jpg
Clear the "Icon" field if you do not have a *.png file to put in your *.jar file. 
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
j2me_wireless_toolkit_1_4_ktoolbar_clean_build_create_package.jpg
The result of building the *.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 Internet 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" (run) button. 
j2me_wireless_toolkit_1_4_ktoolbar_project_launch.jpg
j2me_wireless_toolkit_1_4_ktoolbar_project_running.jpg
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 Internet site without modification, and it should work.  Here is what I saw on my cellular phone after downloading this compiled application "over the air" (OTA)
sbj_screen_on_phone.jpg
Sam Robertson's Blackjack Trainer (sbj.jar) executing on my cellular phone

7. Offering software on an Internet site

7.1 Ensure that the Internet web server specifies MIME types for *.jar files and *.jad files

If you have an Apache Internet web server, you need to create a file named ".htaccess" within your web site root directory.  The ".htaccess" file enables you to override Apache configuration, such as adding or overriding file MIME types.  You must add the specify the MIME types corresponding to *.jar files and *.jad files, as shown in the following text file: 
htaccess_image.jpg
My custom ".htaccess" file for the Apache Internet web server.  Note: I named this file ".htaccess.txt" merely to make the file easy to edit when using the Windows operating system.  The file name must be changed to ".htaccess" before the file can be used with the Apache Internet web server. 
Here is my simple .htaccess file as plain text:
AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
AddType text/vnd.wap.wml wml
Apparently, creating or modifying this file results in an immediate change of Apache server behavior.  I guess the Apache server checks the modification date and time of the ".htaccess" file upon each new incoming transaction, and the server reloads that file if the modification date and time has changed. 

If you have a different kind of Internet web server, you must determine how to specify MIME types, and you must ensure that *.jar files and *.jad files are assigned the appropriate MIME types. 

You will know if the MIME types have not been set up if the cellular phone refuses to download your *.jad file and reports the following error: 

"406: Not Acceptable" 

7.2 Optionally provide links to the *.jad file within HTML or WML documents

The Motorola T720 J2ME cellular phone with AT&T service is able to download a *.jad file directly, by typing the URL of the *.jad file in to the cellular phone.  This is likely to work for other J2ME cellular phones with other cellular phone service providers. 

However, it might be more convenient for people to download the *.jad file by selecting a link within an HTML document or within a WML document.  (Note: WML is now obsolete. Most cellular phones can now interpret HTML.) 
file_image_hi_html.jpg
A simple HTML document with a link to a *.jad file
file_image_hi_wml.jpg
A simple WML (WAP) page with a link to a *.jad file  (Note: WML is now obsolete. Most cellular phones can now interpret HTML.) 

8. Downloading software from an Internet site

The following images show the exact sequence of actions I did to download and execute the MIDlet developed and deployed as described in the previous sections above.  These images are photographs of the screen of my cellular phone. 
t720_screens_download_program.jpg
(1) Main screen: When you open the phone, you see the main screen. Press the center button to go to the main menu. 
(2) Main Menu: Move to the item "WebAccess". 
(3) WebAccess: Move to the item "Go To URL". 
(4) Enter URL: Type in the URL of a *.jad file (or of an HTML document, or of a WML document). 
(5) Details; This information was parsed from the *.jad file. Press DOWNLD to download the *.jar file. 
(6) Download Complete; Wait for this message to disappear; 
(7) Installing; Wait for this message to disappear; 
(8) xxxx bytes transferred; Wait for this message to disappear; 
(9) Installed; Wait for this message to disappear; 


When the WebAccess menu appears again, after the program has been installed, simply exit each menu to return to the main screen. 
t720_screens_start_program.jpg
(1) Main screen: When you open the phone, you see the main screen. Select the "Games & Apps" option via the main menu, or press the downward cursor on the main screen. 
(2) Java Powered: Wait for this screen to disappear. 
(3) Games & Apps: Select the item with the name of your program! 
(4) Yay! Successful execution of your program! 
The program appearance on the cellular phone is very similar to the appearance within the emulator.

9. Download error messages and installation error messages

9.1 Motorola T720 (J2ME) error messages

The following errors messages are only relevant to the Motorola T720 (GSM/J2ME) cellular phone. 

9.1.1 "Download Failed"

Cause #1
Any file (HTML, JAD, JAR, MID, GIF) over 1644 bytes will cause this error for certain Internet web hosts and servers.  Here is a brief list of hosts and servers: 
Host / Server                                               Error
===================================================    =================
Apache                                                       No
Microsoft Personal Web Server (direct from your PC)          No
Earthlink (Apache)                                           No
Yahoo! (custom server)                                       Yes
The problem is due to a flaw in the Motorola T720 GSM/J2ME firmware, which causes downloading files in fragments to fail.
The only apparent solution is to switch Internet web hosts or server type.  Other cellular phone types do not have this problem. 
Cause #2
The "MIDlet-Jar-Size:" field of a *.jad file does not indicate the exact byte total of the corresponding *.jar file.

9.1.2 "Failed: File Corrupt"

Cause #1
The *.jar file uses API functions which are not available on the specific cellular phone. 

For example, MIDP 2.0 functions are not available on the Motorola T720 GSM/J2ME cellular phone (which only has MIDP 1.0 functions).  A program might execute within an emulator, but might not execute on the cellular phone. 

The solution is to search for MIDP 2.0 functions in the source code and replace them with MIDP 1.0 functions, or eliminate the features which require the MIDP 2.0 functions. 
Cause #2
The "manifest.mf" file used to create the *.jar file (via the "jar" utility) contains errors. 

Make sure the "manifest.mf" file has the following versions of CLDC and MIDP: 
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
The entire "manifest.mf" file should look almost exactly like the following: 
MIDlet-1: My_Description,, HelloMIDlet
MIDlet-Name: My_Midlet_Suite
MIDlet-Vendor: Colin Fahey, Inc.
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.0
MicroEdition-Profile: MIDP-1.0
Each line of text in the "manifest.mf" file, including the final line of the file, should end with a "carraige return" (CR; 13; 0x0d) character followed by a "line feed" (LF; 10; 0x0a) character. 

The only fields of the "manifest.mf" file in your own version of the file that should differ from the example shown here are the first three fields listed in the example.  The final three fields should be an exact match with the example, and the final two characters of the file should be the "carriage return" and "line feed" after the final field. 

Here are possible problems in your version of the "manifest.mf" file: 
(1) Your "manifest.mf" file contains characters that are not ASCII characters; (Look at a chart of ASCII characters; any character outside the 0 through 127 range is invalid); 
(2) Your "manifest.mf" file does not have a "line feed" (LF) character after each "carriage return" (CR) character at the end of each line; 
(3) Your "manifest.mf" file has invisible spaces or tabs at the end of each line before the (CR)(LF) line termination; 
(4) Your "manifest.mf" file contains a "Manifest-Version:" line; 
(5) The final line of your "manifest.mf" file does not end with a (CR)(LF) line termination, but instead simply reaches the end of the file; 
(6) Your "manifest.mf" file does not have the exact fields and exact order of fields as shown in the example above; 
(7) Your CLDC version is not exactly 1.0, or your MIDP version is not exactly 1.0; 
(8) Your vendor name has characters which are not ASCII characters (e.g., no Unicode characters are allowed); 
(9) Your "manifest.mf" file does not have a space after the second comma in the "MIDlet-1:" line; 
Perhaps some of the cases listed above do not actually cause problems for many cellular phones, but eliminating all of the cases listed above might enable the download to succeed.  After the download is successful, you can experiment with variations of the "manifest.mf" file to discover what other things you can do without causing download errors.  When the "manifest.mf" file is modified, it is important to verify that downloading the program continues to work for all target cellular phones and cellular phone service providers.  Some phones and services are less flexible than others. 

When a "manifest.mf" file is added to a *.jar file via the jar program, the jar program creates a new version of the manifest file within the *.jar file.  The generated version of the manifest file within the *.jar file is named "MANIFEST.MF".  The jar program might add fields to this file that do not exist in the "manifest.mf" file provided by the programmer.  Do not extract a "MANIFEST.MF" file from a *.jar file, unless you are prepared to eliminate some fields and make the remaining fields look exactly like the example "manifest.mf" file shown above. 

9.1.3 "Unsupported Content Type"

Cause #1
The cellular phone cannot accept the MIME type reported by the remote server for a specific file. 

For example, JPG image files are not supported by the Motorola T720 and will cause this error.

This error can also occur if the MIME type for a supported file type (e.g., GIF, MID, JAD, JAR) is not reported correctly by the server.  A person must be very careful to report the exact MIME type for the supported file types. 
Cause #2
The file cache on the cellular phone itself needs to be cleared (e.g., Browser Settings -> Clear Cache). 

If you recently added MIME types to a remote server, and then attempted to download a file that had previously failed to install due to an incorrect or missing MIME type, then the file cache on the cellular phone might be an obstacle to downloading the file again with the proper MIME type. 

It is also possible that the remote file was modified and that the cached version is defective and is preventing the repaired file version from being downloaded as a replacement. 

Clearing the browser cache on the cellular phone should ensure that a subsequent download benefits from the latest server configuration (e.g., new MIME settings) and remote file updates. 
Cause #3
[From Motorola documentation: http://developers.motorola.com/developers//wireless/global/emea/other/UCT.html]
How to avoid "Unsupported Content type" errors in WAP 

If you get an error in WAP saying Unsupported Content type, it's not necessarily due to the content-type setting.  Many WAP pages contain special characters, such as Swedish (å ö ä), and in order to get them to display properly you need to specify which character set you use.  In order to specify which character set is used on a WAP page, you modify the Content-Type header in the server response to include the character set, for example "Content-Type: text/vnd.wap.wml; iso-8859-1".  When a user gets the response from a server, it should have all the needed information to display the content properly. 

However, there's a problem with using this approach.  All phones indicate to the gateway which character set they support by using "Accept-Charset" in the request header.  According to HTML specifications, this should be compared to the character set specified in a server response, and if they don't match, the error Unsupported Content type should be generated. 

To make the problem more complicated, some WAP gateways don't care about comparing the character set supported by the requested device, hence the content will not display properly on those devices.  Another complication is that the string specifying the character set is case insensitive, but some WAP gateways treat them as case sensitive strings. 

All together, there will be very different results depending on what device you use, which WAP gateway you use and what the server response is. 

The only way to be sure that your content will be displayed properly is to always check what character set is accepted by the client and transform your response to that character set before sending it. 

9.1.4 "406: Not Acceptable" ("The server cannot generate a response that your client can accept.")

Cause #1
You have a Verizon phone! 

Verizon does not allow its customers to download images (GIF), ring tones (MIDI), or programs, from arbitrary Internet web servers.  One must either use their "Get It Now" service, or use a USB cable and the "Get Around 'Get It Now' (GAGIN)" software. 

Solution: Simply wait for competition in the "free market" to eliminate "closed platforms".  The whole technology might be obsolete by the time this succeeds, but this is what happens when companies are guided by greed alone. 
Cause #2
The error message indicates that the MIME type associated with the file extension (e.g., .gif, .mid, .jar) of the file being downloaded has not been specified by the Internet web server.

If you have an Apache Internet web server, for example, then you must modify an ".htaccess" file, adding the following lines:
AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
AddType text/vnd.wap.wml wml
AddType audio/midi mid

9.1.5 "413: Requested Entity Too Large"

Cause #1
The server hosting the file being downloaded did not specify the MIME type for that file (e.g., GIF, MID, JAR).  Thus, the cellular phone assumes that the file is plain text.  Also, the cellular phone might have a limit on the size (in bytes) of text files which is smaller than the limit on the size (in bytes) of binary files (e.g., GIF, MID, JAR).  Therefore, a binary file interpreted as a text file is likely to exceed the maximum allowed size of a text file, and will thus cause the error. 

If you have an Apache Internet web server, for example, then you must alter an ".htaccess" file, adding the following lines:
AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
AddType text/vnd.wap.wml wml
AddType audio/midi mid
Cause #2
Apparently this error can also occur even if the remote server has the proper MIME types established.  I have not yet determined when this error occurs instead of the "Download Failed" for this situation. 

Evidently, the Motorola T720 GSM/J2ME cellular phone cannot process an aspect of the HTTP 1.1 specification which allows for files to be broken in to fragments, requiring multiple "GET" requests. 

When using the Motorola T720 GSM/J2ME cellular phone to download files from certain Internet web server types, any file (e.g., HTML, JAD, JAR, MID, GIF) larger than 1644 bytes will cause this error.  Here is a brief list of Internet web hosting providers and whether or not the Internet web hosting provider causes a problem for the Motorola T720 GSM/J2ME cellular phone:
Host / Server                                               Error
===================================================    =================
Apache                                                       No
Microsoft Personal Web Server (direct from your PC)          No
Earthlink (Apache)                                           No
Yahoo! (custom server type)                                  Yes
The problem is due to the firmware in the Motorola T720 GSM/J2ME cellular phone, which affects its ability to download files in fragments. 

The only apparent solution, when downloading to the Motorola T720 GSM/J2ME cellular phone, is to avoid certain Internet web hosting server types.  Most other cellular phone types do not have this problem, and so this problem might now be safely ignored. 

9.1.6 "Connection unsuccessful. Try again later."

Cause #1
This error has nothing to do with the Internet server that is hosting the requested file. 

If you get this error, I suggest that you do the following things: 
(1) Clear the browser cache; 
(2) Clear the browser history; 
(3) Turn off the phone; 
(4) Remove the battery; 
(5) Wait a few seconds; 
(6) Put the battery back in to the phone; 
(7) Power up the phone; 
(8) Try the download again; 
I received the "Connection unsuccessful. Try again later." error message for several days after I first purchased a cellular phone.  Then, by random chance, I removed the battery.  When I put the battery back in to the cellular phone, I immediately had access to the Internet. 

I received this error several times during the subsequent six months, and the procedure above has restored access to the Internet each time.  I did not determine which step of the procedure might be the most important, but I believe that simply removing the battery and putting the battery back in to the cellular phone might be sufficient. 

In my opinion, this error message is too vague.  Why was the attempt to connect unsuccessful?  Was the cellular phone service network too busy?  Was the cellular phone service's "Gateway" server not functioning?  Is my cellular phone not receiving or transmitting enough radio signal strength?  When would be a good time to attempt the download again?  Ten seconds from now?  An hour from now?  A week from now?  The error message would be more helpful if it were more specific about the cause of the problem and if it were more specific about a possible solution. 
Cause #2
If you did a "Master Reset", or if you have never been able to access the Internet, then inspect the network settings on the cellular phone.  For an example of network settings (for the Motorola T720 GSM/J2ME cellular phone, for AT&T service in the Los Angeles, California area), see the section specified by the following link: 
AT&T cellular phone configuration settings (for the network)

10. Creating, offering, and downloading "ring tones"

10.1 Create or acquire a MIDI file (*.mid)

You can create or acquire a MIDI sound file (*.mid) from any source.  I found the theme music to the television show "Knight Rider" (1982-1986) in MIDI format (e.g., "knightrider.mid") by a simple search of the Internet. 

The following image gives you some idea of how a MIDI file appears in a MIDI editor.  It is not necessary to have a MIDI editor to get music on to your phone.  You can get an existing MIDI file (*.mid) from any source.  However, you can also use a MIDI editor of your choice to create your own original polyphonic music. 
home_studio_midi_knight_rider.jpg
Cakewalk Home Studio : playing "knightrider.mid"

10.2 Ensure that your Internet web server knows the MIDI MIME type

If you have an Apache Internet web server, for example, then you must alter an ".htaccess" file, adding the following lines: 
AddType audio/midi mid
The ".htaccess" file will specify or override the MIME types indicated by the server for files of various types (typically indicated by the file extensions, such as .MID, .GIF, .JAR). 

If you have already added other MIME types for other file types, your complete ".htaccess" file might resemble the following text:
AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar
AddType text/vnd.wap.wml wml
AddType audio/midi mid
Apparently, creating or modifying this file results in an immediate change of Apache server behavior.  I guess the Apache server checks the modification date and time of the ".htaccess" file upon each new incoming transaction, and the server reloads that file if the modification date and time has changed. 

If you have a different kind of Internet web server, you must determine how to specify MIME types, and you must ensure that *.jar files and *.jad files are assigned the appropriate MIME types. 

You will know if the MIME types have not been set up if the cellular phone refuses to download your *.jad file and reports the following error: 

"406: Not Acceptable" 

10.3 Put the MIDI file (*.mid) on to your Internet web server

I copied a MIDI file named "kr.mid" to the root directory of my Internet web server.  You can use software such as "Filezilla" to make the FTP transfer simple and convenient. 

10.4 Download the MIDI file to your cellular phone via your phone service's Internet service

For the Motorola T720 GSM/J2ME cellular phone, downloading a MIDI file begins with the "WebAccess" menu.  Selecting "Go To URL", followed by typing the URL of the MIDI file, starts the download.  For example, I typed in the following URL:
http://www.colinfahey.com/kr.mid
If the download is successful, and if you are using a Motorola T720 cellular phone, you will be given the option of storing the file on your cellular phone.  When you decide to store the file, you are given the option of simply storing in your set of ring tones or instead setting the file to be the current ring tone (which also, as a side effect, stores in your set of ring tones). 
The following images summarize the process of downloading and playing MIDI files for the Motorola T720 GSM/J2ME cellular phone.  Other J2ME enabled cellular phones, with other cellular phone service providers, are likely to have a similar download procedure.  If your cellular phone service provider is Verizon, then you are out of luck; none of this will work, and you should go and buy an "Android" phone to help destroy the "closed phone" market! 
t720_screen_midi_download.jpg
(1) Main screen: Press the appropriate button to show the main menu. 
(2) Main Menu: Go to the "WebAccess" item. 
(3) WebAccess: Go to the "Go to URL" item. 
(4) Enter URL: Type in the URL of a MIDI file (*.mid) on an Internet web site. 
(5) Connecting: Wait for the download to begin. (If you received the "406: Not Acceptable" error message, then the Internet web server did not assign an appropriate MIME type for MIDI files (*.mid)).) 
(6) Downloading: Wait for the downloading to finish. 
(7) Download Complete: Wait for this screen to disappear. 
(8) MIDI Playback: The MIDI file starts playing immediately. Press the menu button to go to the Tone Menu, and continue to step (9), or press the "STORE" button and go to step (12). 
(9) Tone Menu: You have the option of playing... 
(10) Tone Menu: You have the option of getting details. 
(11) Details: Here we see the size in bytes. 
(12) Store Options: From step (8) we can hit the "STORE" button to get to this menu.  You have the option of storing to the phone's collection of tunes.  Hit "SELECT" to store. 
(13) Stored: The MIDI tune has been stored. 
(14) Total Bytes Transferred: This is simply a notification of the number of bytes downloaded, so that you aren't surprised by your upcoming cellular phone service bill! 

10.5 Play the MIDI file at any time on the cellular phone

You can play the stored MIDI files at any time on your cellular phone, and you can use any MIDI file as your ring sound.
t720_screen_midi_playback.jpg
(1) Main screen: Press the appropriate button to go to the main menu. 
(2) Main Menu: Go to "Media Center". 
(3) Media Center: Go to "My Tones". 
(4) My Tones: Highlighted tone starts playing immediately.  You can change the name with the "EDIT" option.  Hitting the menu button gives you other options. 

10.6 Set the ring style to use a MIDI file

Go through the following menu screens:

(1) Main screen 
(2) Main Menu 
(3) Ring Styles : Press "SELECT" 
(4) [Silent, Soft, Loud] Detail : Press "CHANGE" 
(5) Calls: [current ring style/tune] : Press "CHANGE" 


Scroll though list of ring styles (silent, vibration styles, permanent ring tunes, etc), and at the bottom you will see your downloaded tunes.  Simply press the "SELECT" button to make your new ring tune active! 

11. Creating, offering, and downloading images

11.1 Create a 120 * 160 GIF image file (*.gif)

The following steps can be used to create a 120 * 160 GIF image file (*.gif) suitable for displaying on the Motorola T720 GSM/J2ME cellular phone, either as a background image for the main screen, or as an image in the image gallery. 
(1) Open any image file with Microsoft Paint or Adobe Photoshop or any other suitable image editing software; 
(2) Scale or crop the image to 120 pixels wide and 160 pixels high (i.e., a 120 * 160 pixel image); 
(3) Save the file in a GIF image format (*.gif); (Within Adobe Photoshop the way to do this is: File -> Export -> Gif89a) 
The image file must be in the GIF image file format so that the Motorola T720 cellular phone is able to decode and display the image.  If the image dimensions are exactly 120 * 160, then the image will fit perfectly on the screen of the Motorola T720 cellular phone; otherwise the image will have blank borders on two sides. 
Note: I successfully downloaded and displayed a *.gif image file which was 118 * 120 pixels, which is smaller than the screen size of 120 * 160.  I think the remaining part of the screen is filled with a color selected from the border of the image.  Perhaps the pixel color of the pixel in the upper left of the image is used as the color for the empty borders surrounding two sides of the image. 
The Motorola T720 cellular phone can display 4096 colors, which I think is encoded as 12-bit RGB (4-4-4).  Therefore, I think images with small color gradients that span large areas should be avoided, because the borders of these gradients will be very obvious and distracting to a person looking at the image.  Also, the GIF format itself is limited to only 256 different colors, so a person needs to be aware of this limitation, too.  In any case, it is always best to simply look at an image on the cellular phone to know whether or not the image is suitable for the cellular phone. 
si.gif
Space Invaders (space invaders) : a 120 * 160 GIF image

11.2 Put the GIF image file (*.gif) on to your Internet web server

I copied a GIF file named "si.mid" to the root directory of my Internet web server.  You can use software such as "Filezilla" to make the FTP transfer simple and convenient. 

11.3 Download the GIF file to your cellular phone via your phone service's Internet service

For the Motorola T720 GSM/J2ME cellular phone, downloading a GIF image file begins with the "WebAccess" menu.  Selecting "Go To URL", followed by typing the URL of the GIF file, starts the download.  For example, I typed in the following URL:
http://www.colinfahey.com/si.gif
If the download is successful, and if you are using a Motorola T720 cellular phone, you will be given the option of storing the file on your cellular phone.  When you decide to store the file, you are given the option of simply storing in your set of images or instead setting the file to be the current background (i.e., "wallpaper"). 
The following images summarize the process of downloading GIF image files for the Motorola T720 GSM/J2ME cellular phone.  Other J2ME enabled cellular phones, with other cellular phone service providers, are likely to have a similar download procedure.  If your cellular phone service provider is Verizon, then you are out of luck; none of this will work, and you should go and buy an "Android" phone to help destroy the "closed phone" market! 
t720_screen_image_download.jpg
(1) WebAccess: Go to the "Go to URL" item. 
(2) Enter URL: Type in the URL of a GIF image file (*.gif) on an Internet web site. 
(3) Connecting: Wait for the download to begin. (If you received the "406: Not Acceptable" error message, then the Internet web server did not assign an appropriate MIME type for GIF image files (*.gif)).) 
(4) Preview of downloaded image, with option to "STORE" (store) the image in the memory of the cellular phone; 
(5) Store Options: The GIF image can simply be stored, or it can be used to replace the current "wallpaper" (background of the main screen), or it can be used as a "screen saver" (i.e., an image which will appear when the cellular phone buttons have not been pressed for a specified amount of time). 
(6) Changed: Wallpaper [image name]: This is simply a notification that the "wallpaper" image has been changed. 
(7) The appearance of the the main screen of the cellular phone after the "wallpaper" (i.e., background) image has been changed.  The "Space Invaders" have conquered my cellular phone! 

11.4 Animated GIF image for use as a "screen saver" on the cellular phone

To download an animated GIF image to use as a "screen saver" image on your cellular phone, simply follow the instructions in the previous section of this document for preparing and downloading an image. 
If the GIF image is an animating GIF, then the "screen saver" will show this animation. 
Simply set the image as the "screen saver" image after the image has been downloaded. 
The following animated GIF image can be used as an animated "screen saver" image on the Motorola T720 GSM/J2ME cellular phone. 
sun.gif
An animated GIF image which can be used as an animating "screen saver" image on the Motorola T720 GSM/J2ME cellular phone.
Sadly, the Motorola T720 cellular phone does not animate the "wallpaper" image.  It would have been very awesome to open the cellular phone and see an animating background on the main screen!  :^( 

You will only see an animated GIF appear on the Motorola T720 cellular phone when the phone enters "screen saver" mode, which might require 30 seconds or more to start.  (You can set this delay in one of the menus.)  The screen illumination is likely to turn off before the screen saver appears.  The "screen saver" does not appear during an active phone call.  Therefore, considering all of these facts, the "screen saver" feature of the Motorola T720 cellular phone is rather lame. 

12. Motorola T720 GSM/J2ME cellular phone settings for the AT&T cellular phone network

12.1 Introduction

This section of this document is unlikely to be useful to anyone, because this section describes settings for a very specific cellular phone (Motorola T720 GSM/J2ME) for a very specific cellular phone service provider (AT&T) for a very specific region (Southern California).  However, I include this information for historical interest. 

12.2 Web Sessions settings

Main Screen
  Main Menu
    More... (Not necessary if list view instead of icon view)
      Web Sessions
        mMode (NOTE: Do [New Entry] if no nMode entry)
          (*** Hit menu key, not LAUNCH! ***)
            Edit
              Name:           mMode
              Homepage:       http://home
              WAP IP 1:       10.250.250.250
              WAP Port 1:     9203
              WAP IP 2:       10.250.250.250
              WAP Port 2:     9203
              Timeout:        2 minutes
              CSD No. 1:      ____________ (blank)
              User Name 1:    ____________ (blank)
              Password 1:     ____________ (blank)
              Speed (Bps) 1:  9600
              Line Type 1:    ISDN
              CSD No. 2:      ____________ (blank)
              User Name 2:    ____________ (blank)
              Password 2:     ____________ (blank)
              Speed (Bps) 2:  9600
              Line Type 2:    Modem
              GPRS APN:       proxy
              User Name:      ____________ (blank)
              Password:       ____________ (blank)
Also, there is a DNS setting for Java programs:
Main Menu
  Settings
    Java Tools
      DNS IP:  10.250.1.10

12.3 Comments

(1) Doing a "master reset" will set the WAP Port numbers to "9201", so these must be changed to "9203". 

(2) The secondary WAP IP and Port is set to the same IP and port as the primary WAP settings.  I was able to use "mMode" (i.e., go to any URL) with a totally blank secondary WAP setting, but I had "Line Type 1: Modem" at that time.  I don't know if setting it to "ISDN" makes it more likely that the secondary WAP settings will be used. 

(3) A "master reset" makes the "Timeout:" field "15 minutes".  Change the value to "2 minutes". 

(4) The "Name:", "Homepage:", and "GPRS APN:" fields all involve typing in letters and symbols manually. 

(5) The fields which are shown empty in the example above are really intended to not have any text entered.  The blanks are not accidental. 

13. Links to other cellular phone resources

13.1 Motorola J2ME SDK 3.0

Motorola has a software development kit SDK that includes an emulator capable of emulating many Motorola phones, including the T720.  You can get this SDK for free, and you do not need CodeWarrior to use the phone emulator included with the SDK, despite all the mention of CodeWarrior on the Motorola web site.  Also, in general I think you can get by without CodeWarrior or Motorola SDK even if you are doing professional development for the T720.

You must register with Motorola to even learn about their J2ME SDK, let alone download it. 

http://kb.motorola.metrowerks.com/motorola/developmentTools.do

There are some functions for playing "Compact MIDI" and even "*.wav" files.  Install and read the documentation to learn more details. 
Here's a comment I received in an e-mail:
The Motorola J2ME SDK gives you (among other things) "skins" for the emulator so that the emulator will look like the phone you're programming for.  It's more than cosmetic.  Screen size can vary for example, so if you're designing something where screen size matters, it definitely helps to have an emulator that matches the target.  The SDK also includes some Motorola created open Java classes called the Lightweight Windowing Toolkit that give you some of what you need to create an application with a real UI - various UI widgets. 

You can get by without it, but if you were doing serious work you'd probably want to have it.  If I was creating stuff for Sony Ericsson or Nokia or any other phone, I'd want their SDKs too. 
Here's a quote from Motorola's web site regarding their SDK:
The Motorola Software Development Kit (SDK) for the J2ME™ platform is a tool used for developing and testing programs written in the Java programming language.  The SDK includes applications that make it easy to launch MIDlets (J2ME™ Programs) using the Motorola J2ME™ device emulator.  Together these tools allow you to develop and debug your J2ME™ programs in emulation before downloading them to a target device.  The Motorola SDK can be integrated into Metrowerks' CodeWarrior™ Wireless Studio, Professional Edition, Version 7. 

This version of the SDK includes numerous enhancements for performance and stability.  All of the functionality of the previous version is supported, with these new features: 

New handsets supported by this version: A830. 

New functionality supported by this version: 

A830 - Gaming API, Serial Port Connectivity, HTTPS protocol support.
All devices - Improved graphics performance

The SDK supports the following devices:
*Motorola Accompli (008/6288 and 388)™
*Motorola T280i
*Motorola T720
*Motorola v60i
*Motorola v66i
*Motorola iDEN i1000
*Motorola iDEN Platform
*Motorola StarTAC™
*Motorola i85s

13.2 Sun ONE Studio 4 update 1, Mobile Edition

A friend of mine apparently had no problem downloading and using this toolkit -- which apparently gives you everything you need (JDK, MIDP, CLDC) and extra tools to make the JAD, etc.  I haven't tried it myself.  Here are other comments on this toolkit: 
Quote from a Slashdot posting: 
You could have saved yourself some hassle installing all the different toolkits.  Just download [sun.com] Sun ONE Studio 4 update 1, Mobile Edition, its completely free (as in beer), and is a great integrated development environment (about 20 MB download).  All the tools, emulators and demos from the article are bundled.  Since last week I'm running it under RH Linux 7.2, with 512mb of ram (YOU NEED LOTS OF RAM!!!). 

Took just one minute [sun.com] from skipping the regestration screen to stepping through the worm game in the debugger  (I always love the game worm/snake/nibbles in all its incarnations, and the demo version provided is beautifully programmed - simple but object-oriented and multi-threaded in a tiny amount of code). 

You need to register to download.  Supported platforms: Linux, Windows, Solaris.
Quote from a Slashdot posting:
From the sun download faq [sun.com]: 
"Because of the way our download service handles session management, you cannot resume partial downloads by clicking on the link again in the browser window. Rather, open the download manager program you are using, and resume the download from within the download manager itself.

We continue working with our engineers to enable support for more download managers on more platforms. For now, however, please turn off any other download managers and utilities if you are having download problems."
Downloading big files from sun under linux has been really difficult for about a year now.  The only download manager until recently i had been able to get to work was DAP under windows (warning: Spyware).  Basically most download managers (prozgui, getright, opera) won't be able to deal with Sun's [insincerity].  Ludicrously rather than fix their website to just work, Sun have written their own download manager [sun.com].  Its written in java, and its only tiny 140KB!  The surprising thing is that this is a really excellent download manager , tiny footprint, no browser hijacking, no adware/spyware, works under any OS, automatic file verification, automatic unzips, and solid as a rock 

13.3 Random forum posting:

The Jad and Jar files are the only files needed to run an application on a phone and, depending on the phone and the method you are transferring the app to the phone, you may only need the jar. 

If the applications are to be sent Over the Air (OTA), i.e. via a web URL, you will need to create a link on a page readable by the phone (e.g. wml, cHtml, cHtml) to the JAD file.  For OTA downloads you will also need to set up your web server to handle jar and jad file types.  In apache you need to add the following lines to the httpd.conf file: 

AddType text/vnd.sun.j2me.app-descriptor jad 
AddType application/java-archive jar 

Also, you will need to make sure that the URL for the jar file is the URL for the JAR file on the server, not the local URL 

If on the other hand you want to transfer via IR, Bluetooth or a Cable you just need to transfer the files to the phone, install and run.  The JAD file is generally used specifically to provide the phone information needed for OTA downloads and as such, the Nokia 7650 and some other models you only need to transfer the jar file for non-OTA transfers. 

13.4 http://wireless.java.sun.com/midp/questions/sar/

SAR (or WTP-SAR) stands for Segmentation and Reassembly.  It's an optional feature of the Wireless Transaction Protocol (WTP) within WAP.  SAR defines a method for a WAP gateway to break a large message (a JAR file you're downloading, for instance) into small chunks (the segmentation) and for the phone to piece it back together (the reassembly). 

Not all phones use SAR, but most will access web servers through a WAP gateway.  Nokia uses SAR, while Motorola uses features of HTTP 1.1 to retrieve small chunks of a file one at a time and then reassemble it. 

One problem that arises with WAP gateways concerns MIME types returned by the web server.  If a user requests a JAD or JAR file and the server returns the wrong MIME type, the gateway and subsequently the phone will handle the transfer incorrectly.  To ensure proper downloading of MIDlets, use the following MIME types: 

text/vnd.sun.j2me.app-descriptor jad 
application/java-archive jar 

13.5 Random forum posting

you have to have correct MIME settings on the server that stores .JAD/.JAR files.  After that you'll be able to download apps to your device.  Please keep in mind that: - this process is rather device specific (not necessarily using WA protocol)  - you'd better have absolute paths to .JAD and .JAR set (i.e. http://www.fooserver.com/repository/JoeDoeApp.JAD) 

13.6 Random forum posting

At least in the Siemens devices, you have a specific configuration for Java, which is different from that of WAP and GPRS.  You may navigate through WAP, but when a midlet is found, a different setup is automatically changed to accomplish the download.  In the M50 handy, you have to set the Java profiles according to the parameters of your provider; in the c55 handy, the same set is called "HTTP profile" and it is used also for other kinds of download (e.g., http connections in the midlet). 

13.7 Miscellaneous interesting links on advanced midlet signing stuff

http://wirelesssoftware.info/midp_2.0/javax/microedition/midlet/doc-files/PKIAppendix.html

13.8 Very cool midlet programming introduction

http://wireless.java.sun.com/midp/articles/getstart

13.9 http://wireless.java.sun.com/midp/articles/deploy/

To deploy your wireless applications remotely: 

Upload your application files (JAD and JAR) to a remote web server.  If your project is named games, for instance, upload the files: games.jad and games.jar from the bin directory of your project home (for example, <toolkit>/apps/games/bin).  Note that the two files must end up in the same directory on the server. 

Reconfigure the web server so that it recognizes JAD and JAR files: 

For the JAD file type, set the file extension to .jad and the MIME type to text/vnd.sun.j2me.app-descriptor. 

For the JAR file type, set the file extension to .jar and the MIME type to application/java-archive. 

How you configure the web server depends on which one you're using.  For example, if you're using Tomcat, make sure your web.xml file includes the following lines: 

<mime-mapping> 
<extension>jad</extension> 
<mime-type>text/vnd.sun.j2me.app-descriptor</mime-type> 
</mime-mapping> 
<mime-mapping> 
<extension>jar</extension> 
<mime-type>application/java-archive</mime-type> 
</mime-mapping> 


Change your JAD file's MIDlet-Jar-URL property to specify the URL of your JAR file.  For example, in the copy of games.jad you uploaded to the server, change... 

MIDlet-Jar-URL: games.jar 

...to...

MIDlet-Jar-URL: http://YourWebServerAddress:port/pathTo/games.jar 

13.10 Miscellaneous links

http://www.microjava.com/articles/techtalk/midp?PageNo=3 
http://www.corej2me.com/DeveloperResources/sourcecode/general/multipleMIDlets/index.shtml 

13.11 Nokia J2ME program development links

From a Nokia site:
Nokia's J2ME implementation consists of the industry standard MIDP 1.0 and CLDC 1.0.  The platform is extended by the Nokia User Interface (UI) API.  It gives application developers access to certain basic phone functionality that is not specified by CLDC 1.0 or MIDP 1.0.  The Nokia UI API provides access to simple audio capabilities, vibration, display lighting, as well as some graphics-related enhancements. 
From an e-mail message I received:
So Nokia seems to be really opening up it's phones to any kind of custom modification you can think of.  You could add vibration to java games, add cartoon bubbles to pictures you take, and indeed upload pics to your site!  You could write your own server, and people could upload stuff to you! 
Here are some cool 7650 links:
DOOM on the 7650!!: http://www.wildpalm.co.uk/Doom7650.html 
The 7650 page: http://www.nokia.com/nokia/0,1522,,00.html?orig=/phones/7650/index.html 
Nokia J2ME FAQ: http://www.nokia.com/nokia/0,5184,2776,00.html 
Download SDKs, J2ME tutorials, and more: http://www.forum.nokia.com 

13.12 Cellular phone program links

(1) http://midlet.org 
(2) http://spruce.jp/freemidlets 
(3) http://www.gameloft.com 
(4) http://www.microjava.com 

14. J2ME versus BREW

14.1 Introduction

There are two dominant software platforms for mobile devices: J2ME and BREW.  Many cellular phone carriers have decided to offer phones with J2ME support: AT&T, T-Mobile, and Sprint.  One major carrier has decided to only offer phones with BREW support: Verizon. 

A mobile device that supports J2ME can execute J2ME programs but cannot execute BREW programs.  A mobile device that supports BREW can execute BREW programs, but cannot execute J2ME programs. 

Manufacturers of mobile devices often offer several versions based on different wireless broadcast standards.  For example, Motorola offers two versions of the T720: GSM and CDMA.  Coincidentally, the GSM version of the T720 supports J2ME programs, and the CDMA version of the T720 supports BREW applications.  Thus, although wireless broadcast standards are not technically related to phone operating systems, circumstances in the marketplace have led to this accidental correlation. 

14.2 Cellular phone service providers decide what a customer can do with a cellular phone device

Here is a summary of what cellular phone service providers allow customers to do: 
[A]  AT&T :
   [1] J2ME Applications:
         Download from any site on the Internet, Over The Air (OTA);
   [2] GIF Files (Images):
         Download from any site on the Internet, Over The Air (OTA);
   [3] MIDI Files (Ring Tones):
         Download from any site on the Internet, Over The Air (OTA);
   [4] Data Cable:
         Cannot (officially) be used to transfer files;

[B] Verizon :
   [1] BREW Applications:
         Download for a fee through Get It Now! (GIN), Over The Air (OTA);
   [2] GIF Files (Images):
         Download for a fee through Get It Now! (GIN), Over The Air (OTA);
   [3] MIDI Files (Ring Tones):
         Download for a fee through Get It Now! (GIN), Over The Air (OTA);
   [4] Data Cable:
         Cannot (officially) be used to transfer files;

[C] Sprint :
   [1] J2ME Applications:
         **** UNKNOWN ****
   [2] GIF Files (Images):
         Download from any site on the Internet, Over The Air (OTA);
   [3] MIDI Files (Ring Tones):
         Download from any site on the Internet, Over The Air (OTA);
   [4] Data Cable:
         Cannot (officially) be used to transfer files;

[D] T-Mobile :
   [1] J2ME Applications:
         Download for a fee through T-Mobile's service, Over The Air (OTA);
   [2] GIF Files (Images):
         **** UNKNOWN ****
   [3] MIDI Files (Ring Tones):
         **** UNKNOWN ****
   [4] Data Cable:
         Cannot (officially) be used to transfer files;
AT&T offers the best customer and developer access to the cellular phone devices and to multimedia files on the Internet.  Evidently, AT&T has decided to focus on the business of transporting bytes through their networks, rather than attempting to be in the business of selling multimedia content. 

Verizon is the most oppressive cellular phone service provider of them all.  Their "Get It Now!" business model, which involves artificially restricting customer use of their own cellular phone devices to protect the business of selling multimedia content, has inspired many frustrated customers to terminate their contracts with Verizon or find ways to bypass the "Get It Now!" portal.  Just as movie theaters and sports arenas can charge extremely high prices for food because customers cannot easily access alternative sources of food in those circumstances (i.e., there is a lack of access to competition), Verizon can charge extremely high prices for access to multimedia files and software programs because customers cannot easily access alternative sources for multimedia files and software programs. 

14.3 Binary Runtime Environment for Wireless (BREW)

BREW is "Binary Runtime Environment for Wireless", a proprietary software platform developed by QUALCOMM.  To learn more about BREW, visit the following Internet site: 

http://www.qualcomm.com/brew

The SDK can be downloaded from Qualcomm.  In 2002, the SDK could be used to build software using Microsoft Visual C++ 6.0, and the programs could be transferred to a cellular phone without a "test signature". 

All phones with Verizon contracts use BREW.  All software, images, and music must be transferred through Verizon's "Get It Now!" portal, and usually involves paying fees beyond the network bandwidth costs. 

14.4 Java 2 Platform, Micro Edition (J2ME)

J2ME is "Java 2 Platform, Micro Edition", a "highly optimized" Java runtime environment.  To learn more about J2ME, visit the following Internet site: 

http://java.sun.com/j2me

You might have already done some Java programming.  J2ME includes many of the Java classes used for desktop computer programs.  Obviously, any Java classes which are pure Java code, and do not depend on any hardware or operating system functions, can be compiled to execute within the context of any Java virtual machine. 

A person can create threads, sockets, graphics canvases, etc, very easily.  A person only needs to download a *.JAR file (and possibly a *.JAD file) to install an application on a cellular phone. 

Downloading the Java SDK is free.  The documentation for Java is thorough.  Millions of people have developed code for Java.  There are numerous Internet forums discussing various aspects of Java programming. 

In mere minutes of searching the Internet, I found hundreds of interesting software programs, and images, and sound effects, all for the Motorola T720 GSM/J2ME cellular phone -- and all files cost nothing to download. 

I am very excited by being able to take full advantage of the multimedia aspects of my property (i.e., my cellular phone) without having to pay my cellular phone service provider for anything more than the use of their cellular phone network. 

14.5 My BREW and Verizon horror story

I have created software for both J2ME and BREW platforms, and, in my opinion, I think both technologies have their advantages and disadvantages, and both are quite capable of being used to create sophisticated programs very easily. 

However, a business that is interested in creating and selling software for cellular phones should start by considering a single question: "If I develop software, will I be allowed to sell it?" 

If a business develops software for the J2ME platform, then most cellular phone service providers allow customers to go to any Internet site and download any J2ME software, without imposing any cost beyond the cost of transferring bytes through the cellular phone network.  Thus, a software development business is certain to be able to have access to potential customers, and can make their own arrangements for collecting money from customers for any software purchases. 

If a business develops software for the BREW platform, then Verizon decides whether or not the software will be available for sale to customers.  Furthermore, Verizon will extract a large percentage of the selling price of the software for the privilege of being allowed to sell software through their exclusive portal. 

Here is my BREW and Verizon horror story: 

I had a unique idea for a software program for cellular phones at a time when cellular phones were starting to be able to execute BREW and J2ME programs.  I was very excited because I believed that I could create and publish a unique program for these platforms long before any competitors would be ready to create a similar product.  I was convinced that I might finally do something in my life that would make me wealthy.  So, I quit my job and started work on a BREW version of my software idea.  After six months of hard work, and no income, I was finished with my BREW program!  I was ready to submit it to Qualcomm for testing. 

That's when I made a horrifying discovery: Even if my program passed the quality assurance testing, Verizon would have to approve of the sale of my software -- and Verizon could disapprove of my software for any reason (beyond the obvious reasons of being offensive or in competition with some other aspect of Verizon's business).  I simply didn't imagine this possibility.  Everything I read about BREW development implied that the challenge was to pass quality assurance testing.  Nothing I read mentioned any need to have the software approved by cellular phone service providers.  I would not have been surprised to learn that cellular phone service providers might choose to not sell offensive or malicious programs, but such considerations seemed so unimportant for my particular project that I did not think about the more general concept that cellular phone service providers might choose to not sell ordinary software programs! 

One of my friends, who had already sold several video game programs through Verizon, asked a Verizon representative if Verizon would approve my software for sale on their network...  The Verizon representative said: "no", because there were a few other software programs in that broad genre already.  My software was a vocabulary tutor (with special consideration for the SAT and GRE standardized tests), but the Verizon representative said that the word game genre was already "crowded", despite the fact that there were fewer than 10 word-related programs total in the "Get It Now!" portal, and the other programs were very different (e.g., crossword puzzles, "Scrabble", "Boggle", etc).  My program was a technological achievement: It stored the definitions of 5000 vocabulary words, along with synonyms and antonyms, and word meaning groups (so that quiz questions would be challenging), in a program that was less than 1 MB.  My program would have been unique on the market for many months, and potentially for a couple of years. 

I was angry, depressed, and financially broke.  Six months of work was wasted, all because Verizon only wanted software that was certain to sell thousands of copies in their sales portal, and the Verizon representative didn't think my software had a high sales potential. 

Here is the most important lesson I learned from this bitter experience:  Check every part of a business plan before starting work.  (Ideally, every part of the business plan could be tested repeatedly, by actual execution of the various critical procedures, before and during the effort to create the product.) 

I should have checked whether or not there would be any likely obstacle to selling my software before I started to develop the software.  I would have discovered that Verizon could choose to not allow me to sell my software. 

I learned a second lesson:  Avoid situations in which other people have the ability to determine whether or not you have access to customers! 
colinfahey.com
contact information