W
elcome to the sixth chapter of the "Java ME Beginners Tutorial" series.

Success of any software application largely depends on the ease of its installation. There should be a standard way of packaging your application; a form which is easy to send over a network, and one which is easy to install. In Windows there is the .msi packages (setup.exe?) and in Linux we have the RPMs and DEBs.

In the Java ME arena, the packages are called "MIDlet Suites".

Midlet Suites can contain more than one MIDlets. A MIDlet Suite is not a single file, but a group of two files: JAD file and a JAR file.

JAD File


JAD stands for "Java Application Descriptor" and is a simple text file. If you have installed WTK and followed the exercise in our last chapter, you will find a JAD file in your [INSTALLDIR]\apps\JavaMEBlog\bin directory. Open JavaMEBlog.jad using Notepad and you can see the following contents:
MIDlet-1: JavaMEBlog, JavaMEBlog.png, HelloMIDlet
MIDlet-Jar-Size: 887
MIDlet-Jar-URL: JavaMEBlog.jar
MIDlet-Name: JavaMEBlog
MIDlet-Vendor: Unknown
MIDlet-Version: 1.0
MicroEdition-Configuration: CLDC-1.1
MicroEdition-Profile: MIDP-2.1


This is a JAD file that WTK made for us. The contents of JAD file is arranged in the form of property:value. The valid properties that can come in a JAD file are:

  • MIDlet-Name: This is the name of the MIDlet suite (Do not confuse it with name of individual MIDlets contained in the suite).
  • MIDlet-Version: Version of the MIDlet Suite.
  • MIDlet-Vendor: The name of the person or the company which developed the MIDlet Suite.
  • MIDlet-Icon: Every MIDlet Suite has an icon that appears in the phone menu when the suite is installed. This enables the user to easily identify an application. The value of this property should be the name of the icon. Icons have to be stored in the res folder within the project directory.
  • MIDlet-Description: A short description of the MIDlet suite.
  • MIDlet-Info-URL: A url that gives more information about the MIDlet Suite.
  • MIDlet-: As mentioned, a MIDlet suite can contain more than one MIDlet. For each MIDlet present, there should be a corresponding MIDlet-1, MIDlet-2 etc entry made in the JAD file. The value of this will contain the MIDlet name, Icon for this MIDlet and the MIDlet class name.
  • MIDlet-Jar-URL: URL of the JAR file
  • MIDlet-Jar-Size: Size of the JAR file in bytes.
  • MIDlet-Data-Size: The minimum number of bytes required for persistent data storage.
  • MicroEdition-Profile: What J2ME Profile is required by the MIDlet.
  • MicroEdition-Configuration: What J2ME Configuration is required by the MIDlet.


Not all of these properties are compulsory, but the following are :

  1. MIDlet-Name
  2. MIDlet-Version
  3. MIDlet-Vendor
  4. MIDlet- for each MIDlet in the JAR file
  5. MicroEdition-Profile
  6. MicroEdition-Configuration


JAR File


JAR stands for "Java Archive". A JAR file is a compressed zip file which will contain compiled class files, icons, images and other resources that the application requires during runtime. Since it is a zip file, you can open and inspect it using any zip utility like WinZip. To create a JAR file select Project -> Package -> Create Package from the menu bar. This will create a new JAD and JAR file in the [PROJECTDIR]\bin folder.



Every JAR file will contain a folder named "META-INF" and file named "Manifest.mf" inside this folder. Manifest.mf is again a text file and if you open it using a text editor, you can see that it very much resembles the JAD file. All the JAD file properties that we used earlier can be added to the Manifest file also. The value of compulsory properties like MIDlet-Name, MicroEdition-Profile, MicroEdition-Configuration etc has to match in both the manifest file and JAD file. Other properties can differ between Manifest and JAD file, but in such a case the values in the JAD file is taken.










Previous:Writing the first MIDlet Table of Contents Next:TODO TODO