In this section, you will verify that Eclipse is properly set up for Java® ME development.
The following is assumed:
If you're not familiar with the basic workbench mechanisms, please see the Getting Started chapter of the Workbench User Guide.
In order to use MTJ, you must configure at least one device from
a Java® ME SDK. To install an SDK and configure a device,
go to
Java ME
> Device Management.
For more information about installing and configuring devices, see Device Management in the on-line help.
In order to debug your Java ME MIDlet, you must change some of the default Java debug settings, performing the following steps:
Select the
Window >
Preferences... to open the workbench preferences.
Select
Java >
Debug to open the debugging preferences.
Ensure that both Suspend execution on uncaught exceptions and Suspend execution on compilation errors near the top of the dialog are NOT checked.
Increase the Debugger timeout near the bottom of the dialog to at least 15000 ms.
The resulting settings should be something similar to this:
To save the preferences, simply click on the OK button
Due to limitations in the extensibility of the Eclipse Java Compiler (see Bug 116143 for further information), it is necessary for MTJ to hook into the Eclipse platform at a lower level in order to provide preprocessor support. If you would like to take advantage of MTJ's support for preprocessing, a few extra changes need to be made to your Eclipse installation.
The Eclipse configuration file must be altered to reference the MTJ framework hooks bundle.
osgi.framework.extensions=org.eclipse.mtj.core.hooksIf the property already exists, append
",org.eclipse.mtj.core.hooks"
to the end of the current property definition.You will be warned if you have projects that are configured for
preprocessing, but the necessary configuration changes have not been
made. In this case, a warning will be written to the Eclipse workspace
log file with text similar to
"Preprocessor invoked, but hook is not installed. Consult the
installation instructions for MTJ."
For more information on viewing the workspace log file see the troubleshooting
section of the MTJ documentation.
In order to use ProGuard to produce obfuscated packages, you will need to configure it into MTJ, performing the following steps:
Select the
Window >
Preferences... to open the workbench preferences.
Select the
Java ME preference page to display the Java ME
preferences.
Configure the ProGuard Root Directory.
Note: For the ProGuard Root Directory specified, the package "proguard.jar" will be searched on "lib" subdirectory. If a directory "../proguard" was selected then the file "../proguard/lib/proguard.jar" must exist.
Select the
Java ME > Packaging > Obfuscation preference page to display the Obfuscation
preferences.
Configure any other ProGuard-specific settings that you need.
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.
To save the preferences, simply click on the OK button
In order to debug your MIDlet in Over The Air (OTA) mode, you may want to adjust the OTA Preferences, performing the following steps:
Select the
Window >
Preferences... to open the workbench preferences.
Select the
Java ME >
Over the Air preference page to display the Over the Air preferences.
To save the preferences, simply click on the OK button