Sun Microsystems J2ME manual Jar cfm MyApp.jar MANIFEST.MF -C classes . -C res

Models: J2ME

1 134
Download 134 pages 62.02 Kb
Page 117
Image 117

As a result of this command, preverified class files are placed in the classes directory. If your application uses WMA, MMAPI, or other versions of CLDC or MIDP, be sure to include the relevant .jar files in the classpath.

B.2.2 Package

To package a MIDlet suite, you must create a manifest file, an application JAR, and finally, a MIDlet suite descriptor.

Create a manifest file containing the appropriate attributes as specified in the MIDP specification. You can use any text editor to create the manifest file. A manifest might have the following contents, for example:

MIDlet-1: My MIDlet, MyMIDlet.png, MyMIDlet

MIDlet-Name: MyMIDlet

MIDlet-Vendor: My Organization

MIDlet-Version: 1.0

MicroEdition-Configuration: CLDC-1.0

MicroEdition-Profile: MIDP-2.0

Create a JAR file containing the manifest as well as the suite’s class and resource files. To create the JAR file, use the jar tool that comes with the J2SE SDK. The syntax is as follows:

jar cfm <file> <manifest> -C <class_directory> . -C <resource_directory> .

The arguments are as follows:

<file>: The JAR file to create.

<manifest>: The manifest file for the MIDlets.

<class_directory>: The directory containing the application’s classes.

<resource_directory>: The directory containing the application’s resources.

For example, to create a JAR file named MyApp.jar whose classes are in the classes directory and resources are in the res directory, use the following command:

jar cfm MyApp.jar MANIFEST.MF -C classes . -C res .

Create a JAD file containing the appropriate attributes as specified in the MIDP specification. You can use any text editor to create the JAD file. This file must have the extension .jad.

Note – You need to set the MIDlet-Jar-Sizeentry to the size of the JAR file created in the previous step.

Appendix B Command Line Reference 105

Page 117
Image 117
Sun Microsystems J2ME manual Jar cfm MyApp.jar MANIFEST.MF -C classes . -C res