3 the full development cycle, 1 package, The full development cycle – Sun Microsystems J2ME User Manual

Page 23: Package

Advertising
background image

Chapter 2

Developing MIDlet Suites

11

2.3

The Full Development Cycle

The second development cycle is slightly more complicated:

Edit source code

Package

Install

Run

1. Edit source code. This is the same as in the simple cycle.

2. Package. In this step, the J2ME Wireless Toolkit compiles and preverifies the

source files (essentially the same as the Build step from before). Then it bundles
the Java class files and resource files into a MIDlet suite JAR file and a MIDlet
suite descriptor.

3. Install. MIDlet suites need to be installed before they can be run. You can install

the MIDlet suite into the J2ME Wireless Toolkit emulator or a real device.

4. Run. As in the simple development cycle, run your application and test for

bugs.

In the full development cycle, the first step is identical to the simple development
cycle. Editing source code is the same as always. The Build step is now
incorporated in packaging.

The full development cycle includes two new steps, packaging and installing.
Finally, running an installed application is different in important ways from
running an application in the simple development cycle.

2.3.1

Package

The J2ME Wireless Toolkit automates the task of packaging a MIDlet suite. The end
result of packaging is two files, a MIDlet descriptor and a MIDlet suite JAR. The
descriptor is a small text file that contains information about the MIDlet suite. The
JAR contains the class files and resources that make up the MIDlet suite. Devices
can use the descriptor to learn about the application before downloading the entire
JAR, an important consideration in a memory-lean, bandwidth-starved wireless
world.

To ask the toolkit to package your MIDlet suite, choose Project > Package > Create
Package

from the KToolbar menu. The MIDlet suite descriptor and JAR are

generated and placed in the

bin

directory of your project.

Packaging might involve additional steps. You can use a code obfuscator to shrink
the size of the MIDlet suite JAR, a technique that is described later in this chapter.
In addition, the J2ME Wireless Toolkit provides tools to allow you to
cryptographically sign MIDlet suites. See

Chapter 6, “Security and MIDlet

Signing

,” for more information.

Advertising