Java ME Beginners Tutorial : Packaging
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:
Not all of these properties are compulsory, but the following are :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


0 Responses to Java ME Beginners Tutorial : Packaging