This document provides some discussion on "Best Practices" with EclipseME. While not mandatory, following these guidelines will, we feel, make your life easier during the development process.
Use separate source and Binary Directories
Although it is not mandatory, we strongly, strongly suggest that you configure Eclipse to use separate source and output folders in new projects. Regrettably, this is not Eclipse's default setting.
To make this change, Select the Preferences menu item from Eclipse's Window menu, expand the Java item in the left pane and click on the Build Path item. In the right-hand pane, select the Folders radio button. After you do this, the dialog should look like this:
If you do not configure Eclipse for separate source and output folders, some features of EclipseME, such as resource folders, will not work.
If you want to convert a project that was created without separate source and binary folders into one that does, you can do so using the following steps:
Java Compliance Level
Java compliance level refers to two things. First, it refers to the syntax that the compiler will accept when compiling source files. Java 1.4 introduced the assert keyword, for example. Compiling a source file that includes asserts at a source compliance level below 1.4 will result in assert statements being considered syntax errors.
The second type of compliance level refers to the internal format of the class files that the Java compiler will generate. As Java has evolved, there have been minor changes in the internal format of class files. While newer Java implementations will accept older class file formats, older Java implementations will not accept newer formats.
Many J2ME devices will not accept class files whose format is later than 1.1. Unfortunately, many emulators for these devices accept class files with later formats without any warnings. This can cause great confusion, since the MIDlet will operate perfectly in the emulator, but be rejected by the physical device as invalid.
Therefore, for maximum portability and minimum trouble, we recommend that you always set your project up to generate files in the Java 1.1 format. To the best of our knowledge, this does not cause any compatibility problems with devices that do accept later formats.
Beginning with EclipseME 0.9.0, new MIDlet suite projects can automatically be set up this way using the "Force Java 1.1 compliance" option on the "New Midlet Suite" preferences. You can adjust the compliance level of an existing project as follows:
The use of resource directories is a much more personal choice than the items above. Some developers feel strongly that non-Java files should not be in the source area, while others see no issue with mixing Java source files and resource files. Eclipse itself is completely agnostic on this subject. In fact, the Eclipse actually treats a resource directory just like any other source directory.
If you want your projects automatically created with a resource directory, simply make sure to check the appropriate box on the "New Midlet Suite" preferences page and enter your preferred name for the resource directory.
If you would like to add a resource directory to an existing project, simply create the folder in your workspace, and then add it to the Source tab in the Java Build Path item of your project's properties.
Copyright © 2005, http://www.eclipseme.org. All rights reserved.