Java Reference
In-Depth Information
The following attributes are optional but are often useful and should be
included:
•
MIDlet-n
: the name, icon and class of the nth MIDlet in the JAR
file (separated by commas); the lowest value of n must be 1 and all
following values must be consecutive; the name is used to identify the
MIDlet to the user and must not be null; the icon refers to a PNG file
in the resource directory and may be omitted; the class parameter is
the name of the class extending the MIDlet class
•
MIDlet-Description
: a description of the MIDlet suite
•
MicroEdition-Configuration
: the Java ME configuration re-
quired, in the same format as the
microedition.configuration
system property, for example, 'CLDC-1.0'
•
MicroEdition-Profile
: the Java ME profiles required, in the
same format as the
microedition.profiles
system property,
that is 'MIDP-1 0' or 'MIDP-2.0'; if the value of the attribute is 'MIDP-
2.0', the target device must implement the MIDP profile otherwise the
installation will fail; MIDlets compiled against MIDP 1.0 will install
successfully on a device implementing MIDP 2.0.
The following is the JAD file for our HelloWorld application:
MIDlet-1: HelloWorldMIDlet,,example.HelloWorldMIDlet
MIDlet-Description: Example MIDP MIDlet
MIDlet-Jar-Size: 1042
MIDlet-Jar-URL: HelloWorld.jar
MIDlet-Name: HelloWorld Midlet Suite
MIDlet-Vendor: Midlet Suite Vendor
MIDlet-Version: 1.0.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.0
You can automate the task of creating the JAD file by clicking
Package/Create Package in the WTK menu. The WTK creates
Hel-
loWorld.jar
and
HelloWorld.jad
in the
bin
folder of your project
root. You can use Windows Explorer to browse to that folder and check
that the package files have been correctly created. You can open the JAD
file with a standard text editor to inspect its contents. Double-clicking the
JAD file executes your application in the emulator (see Figure 2.4).
2.3 MIDP Graphical User Interfaces API
In this section, we take a look at the main APIs provided by the MIDP
profile for GUI application development. Designing a user interface