logoTop pad
Table of Contents
Creating a new project
Creating a new MIDlet
Packaging for deployment
For EclipseME developers

Eclipse Ready Logo
SourceForge.net Logo


In order to deploy a J2ME MIDlet Suite for use on a J2ME device, it must first be deployed as a JAD and JAR file. EclipseME provides built-in support for packaging a MIDlet Suite into appropriate JAD and JAR files.

  1. How to package your MIDlet Suite
  2. Packaging options
  3. Packaging outputs
  4. Packaging using Antenna
  5. Signing while packaging

How to package your MIDlet Suite

EclipseME packaging support is provided via the J2ME MIDlet Suite project context menu as shown in this snapshot.


Packaging Options

There are two packaging options - Create Obfuscated Package and Create Package.

Create Package

When the Create Package action is run, it will deploy the JAD file and JAR file into the deployment directory specified in the Preferences. The deployed JAR file will contain the verified classes and resources.

Create Obfuscated Package

When the Create Obfuscated Package action is run, it will deploy the JAD file and JAR file into the deployment directory specified in the Preferences. The deployed JAR file will be obfuscated by the using the Proguard Java Tool as specified in the Preferences.

Obfuscated packages are useful in providing a small level of security for your deployed MIDlets. More importantly, obfuscation generally leads to smaller deployed JAR file sizes.

In order to produce obfuscated packages, the Proguard Java obfuscation tools must be installed and the root of the Proguard installation must be configured in the Obfuscation Preferences. Proguard is a free open-source library that is available for download from http://proguard.sourceforge.net/.

Errors and Warnings During Obfuscation

It is possible that there will be warnings or errors during the obfuscation process. When this occurs, a prompt will be opened to allow packaging to continue or be cancelled.


If the warning or error can be safely ignored, you may select Continue and EclipseME will attempt to continue creating the obfuscated package. Depending on the type and severity of the problems encountered the package may not be able to be created.

Packaging Outputs

JAR File Deployment

The deployed JAR file will be created in the deployment directory using the following information:
  • The verified class files found in the verified output directory.
  • The resources found in the resources directory.
  • The manifest file will be based on the contents of the project's source JAD file.

JAD File Deployment

The source JAD file found in the root directory of the J2ME MIDlet Suite project will be copied into the deployment directory during the packaging operation. All changes should be made in the source JAD file as opposed to the deployed JAD file, as the deployed JAD file will be overwritten during the packaging operation.

During deployment of the JAD file, the MIDlet-Jar-Size property of the JAD file will be updated to match the size of the previously deployed JAR file.

Obfuscated Package Outputs

The JAR and JAD files are necessary for deployment to a MIDP capable device. In addition to those files, a number of other files are made available during the obfuscated packaging process. These files are placed in the deployment directory alongside the resulting JAR and JAD files.

  • *_base.jar
    This JAR file contains the initial packaging before the obfuscation processing occurs. This file acts as the source for the obfuscation processing.
  • *_base_obf.jar
    This JAR file contains the obfuscated classes. Preverification will be run against this jar file again to produce the final obfuscated and preverified JAR file.
  • pro_map.txt
    This file contains information concerning the mapping applied from the original source names to the obfuscated names. This file may be used by the Proguard ReTrace command to rebuild the original stack trace from an obfuscated stack trace.
  • pro_seeds.txt
    This file lists the MIDlet classes that were included and acted as the seeds to the obfuscation process.
  • proguard.cfg
    This file holds the configuration that was specified to Proguard in order to generate the resulting obfuscated package.

Packaging using Antenna


If the appropriate prerequisites are not met, an error dialog will be displayed.

Export the Antenna build files from the J2ME project menu. Choose "Export Antenna Build Files". The following files will be generated:

  • build.xml - The root build file that may be executed using standard Ant execution. This file is a skeleton that wraps the eclipseme-build.xml file. This file may be modified and will not be overwritten during subsequent export operations.
  • eclipseme-build.xml - This build file handles the calls to the Antenna library and contains all of the classpath information generated from the Eclipse projects involved in the export. This file should not be altered, as it will be overwritten during each subsequent export operation. This file should be regenerated whenever the project classpath is updated.
  • eclipseme-build.properties - This file contains a set of properties that define the locations and preferences concerning the build. This file should not be altered, as it will be overwritten during each subsequent export operation. The properties in this file may be overridden by creating a user-build.properties in the same directory as the generated files. Properties defined in the user-build.properties will override the values in the eclipseme-build.properties.

Signing while packaging

Beginning with version 0.7.0 of EclipseME, you can automatically have your MIDlet suite signed during the packing process. Signing a MIDlet suite allows it to operate in the "trusted third party" protection domain instead of the "untrusted" protection domain. This can be significant if your MIDlet intends to access protected features.

To have your MIDlet suite signed as part of packaging, check the Sign project box on the Project Properties page. You will need to provide the location of your keystore file, the alias of the key within that keystore file, and, optionally, the password for the keystore and key.

For more information about MIDlet suite signing, click here.

Copyright © 2005, http://www.eclipseme.org. All rights reserved.