Mobile Tools for Java Preferences

To inspect or alter the MTJ preferences, open the Preferences dialog via the Window menu of the workbench. This document describes the various settings to be found there.

1. Device Management
2. Basic Preferences
3. New Midlet Suite Preferences
4. Over the Air Preferences
5. Packaging Preferences
6. Obfuscation Preferences
7. Preverification Preferences

# Device Management

Select the Mobile Tools for Java/Device Management category from the left pane of the preferences dialog to specify preferences that control the device definitions installed into MTJ. For more information about device definitions, see the Device Management information.

# Basic Preferences

Select the Mobile Tools for Java category from the left pane of the preferences dialog. The basic preferences page for MTJ looks like the following:

Preference items:

Item | Contents
Deployment Directory | The Deployment Directory preferences specified the project subdirectory into which deployed JAR and JAD files will be placed during the Create Package operation. In addition, this is the directory in which the built in Over The Air deployment support will search for the JAD and JAR file.

Verified Output Directory Name

The Java ME specification requires that all classes to be run must be preverified. This allows for high levels of security without the inherent costs of the complete J2SE security implementation. MTJ automatically does preverification of class files whenever they are saved if automatic builds are enabled for the workbench. Whenever a class is compiled by Eclipse, MTJ will preverify that class and place the result into this directory.

Antenna JAR | If you would like to use MTJ's built-in support for generating Antenna build files, you need to provide MTJ with the location of the Antenna JAR file here. For more information, see the section on Antenna support.
WTK Root | If you would like to use MTJ's built-in support for generating Antenna build files, you need to provide MTJ with the location of a Sun Wireless toolkit. For more information, see the section on Antenna support.

Debug Server Delay

Some emulators, such as the Nokia emulators, operate as debug servers rather than debug clients. In such emulators, the emulator must be started up before MTJ may connect to it. Because startup time may vary based on a variety of factors, this preference controls how much time (in milliseconds) MTJ will wait for the emulator to start before attempting to connect to the emulator's debug server.

# New Midlet Suite Preferences

Select the New Midlet Suite category from the left pane of the preferences dialog to specify preferences that deal with the creation of a new MIDlet Suite

Item | Contents

Force Java 1.1 Compliance

If checked, when MTJ generates a new MIDlet suite project, it will adjust the project settings so that the Java compiler will generate Java 1.1-compatible class files. If unchecked, the project will be set to use the workspace settings.
Warning: many mobile devices will not accept class files compiled using the post-1.1 class file format. We strongly suggest that you leave this option checked.

Automatically Use Resources Directory in New Projects | If checked, when you create a new MIDlet Suite project, the project will be created with a resource directory, using the name found in the next field.
Resources Directory | This field contains the name of the resources directory that will be created if the check box just above is checked. Note that this feature only applies to new projects, and will only work if you have configured the project to use separate source and binary directories.

# Over the Air Preferences

Select the Mobile Tools for Java/Over the Air category from the left pane of the preferences dialog to specify preferences that control the operation of the Over The Air support of MTJ.

Preference items:

Item | Contents
Start Listening at Startup | Selecting this preference will cause the embedded Over the Air HTTP server to be started when the Eclipse workbench is started. To use the OTA server outside of Eclipse, make sure to have the server started and a port specified. If the emulator is launched within Eclipse, it is not necessary to start the server as it will be started when necessary.
Use Specified Port | To use a specific port for the embedded HTTP server, select this preference and fill in a port. If this preference is not selected, a port will be chosen at random for the Over the Air support.
Specified Port | The value of this preference will be used for the embedded HTTP server if Use Specified Port is selected.
Automatically deploy prior to launch | Over the Air launching requires a deployed midlet JAR and JAD file in order to operate. Selecting this option will cause MTJ to automatically package your midlet suite prior to launching in Over the Air mode if anything has changed since the last packaging operation.

# Packaging Preferences

Packaging preferences control the process of putting together the distribution package files.

Increment Version Automatically

If this option is checked, MTJ will automatically increment the Midlet Version parameter every time the MIDlet suite is repackaged.

Note that, if a version number of the form x.y.z is incremented so that "y" or "z" exceeds 99, this number "rolls" back to zero, and the next number up is incremented. This is done because a significant number of phones generate errors if presented with a JAD file that contains a version number with a three-digit component in it.

Excluded Properties | This area of the packaging preferences allows you to exclude certain of the MIDlet properties from the manifest file that is packaged within the deployed jar as part of the packaging operation. By default, the MIDlet-Jar-URL and MIDlet-Jar-Size entries are excluded.

# Obfuscation Preferences

Obfuscation preferences control the processing of the obfuscated packaging support. MTJ uses Proguard for doing the obfuscation processing.

Preference items:

Item | Contents
Proguard Root Directory | This value specifies the root directory for the Proguard installation. Proguard is required to create obfuscated packaged applications.

Use Specified Arguments

By default, MTJ will use the the arguments
`-dontusemixedcaseclassnames -dontnote -defaultpackage ''`
when invoking Proguard for obfuscation. If circumstances require a different set of parameters to be specified, they may be provided by selecting the check box associated with "Use specified arguments" and specifying the parameters in the text field.
Important note for Microsoft Windows Users: By default, ProGuard assumes that you are using an operating system that can distinguish between two file names that differ only in their case (i.e. A.java and a.java are two different files. This is clearly not the case in Microsoft Windows. Windows users should be sure to specify the -dontusemixedcaseclassnames option to ProGuard. If you fail to do this, and if you have more than 26 classes in your project, ProGuard's default use of case-sensitive file names will cause classes to overwrite one another. For safety, the -dontusemixedcaseclassnames option is included as one of the default arguments to ProGuard. UNIX users with projects with many classes may be able to achieve a small reduction in the final size of their JAR file by removing this option.

Proguard Keep Expressions | Proguard keep expressions may be specified to keep a certain set of classes. For further information concerning the syntax of these expression, please see the Proguard documentation. The default expression will keep all midlet classes and their methods without changes that would confuse the deployment platform.

# Preverification Preferences

Select the Mobile Tools for Java/Preverification category from the left pane of the preferences dialog to specify preferences that control the preverification operations performed by the plug-in.

There are two fundamental issues that one controls with this dialog:

1. Whether to preverify for CLDC 1.0 or CLDC 1.1.
2. Whether to use the external wireless toolkit preverifier or the new internal preverifier.

Item | Contents
Use JAD file settings | Selecting this option instructs EclipseME to look at the JAD file setting to determine whether to use CLDC 1.0 or CLDC 1.1 preverification.
Use project platform definition configuration | Selecting this option instructs EclipseME to use CLDC 1.0 or CLDC 1.1 preverification based on the configuration supported by the platform selected for the project.
Use specific configuration | Selecting this option allows you to choose between CLDC 1.0 or CLDC 1.1 using the pulldown list, regardless of the settings in the JAD file or the project's platform definition.

Use Built-In Preverifier

MTJ includes a native Java implementation of a preverifier. If you check this option, this new preverifier will be used instead of the external preverifier included with the Wireless Toolkit.

NOTE: The internal preverifier is still in a beta state of developement, and is not guaranteed under all circumstances.

That being said, the internal preverifier does provide better feedback on any preverification errors than most of the external preverifiers. The MTJ developers would greatly appreciate feedback on the functionality of the preverifier.