Skip Headers
Oracle® Java Micro Edition Software Development Kit Developer's Guide
Release 3.3 for Eclipse on Windows
E37550-03
  Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

5 Viewing and Editing Project Properties

All projects have properties. Some properties, such as the project's name and location cannot be changed, but other properties can be freely edited as work on your project progresses. This chapter describes how to work with project properties.

To view or edit a project's properties, right-click the project node and select Properties. In the resulting window, you can view and customize the project properties. See the following topics:

5.1 Projects

The Java ME SDK plugin works with Mobile Tools for Java (MTJ) to create CLDC projects. For complete information on creating projects, see the Mobile Tools for Java Developer Guide included in the Eclipse online help. The basic steps to create a MIDP project are as follows:

  1. Select File > New > MIDlet Project.

  2. On the Create a MIDlet Project page, specify a project name and the location in the workspace.

  3. The Configuration list determines the runtime type. If the default device is not what you want, select it and click Remove.

    Click Add to open the Create a MIDlet project page.

    • Supply a configuration name.

    • In the SDK field, choose the Oracle Java ME SDK.

    • In the Device field, select a device from the dropdown.

      For the mobile runtime, choose ClamshellJavaMEPhone, JavaMEPhone1 or JavaMEPhone2. For the IMP-NG runtime, choose IMPNGDevice1 or IMPNGDevice2. You can add more than one device, but they must be for the same runtime.

      You can optionally remove JSRs that your application does not require. Select a row in the Symbols table and click Remove.

      Click Finish.

  4. (IMP-NG projects only). The MicroEdition-Profile value must be IMP-NG. In some projects there is a version number appended and this must be manually removed.

    In the project tree, click Application Descriptor to open a tab with your application properties. At the bottom of your project's tab, select the Application Descriptor tab. Edit the profile if necessary. Figure 5-1 demonstrates the correct setting.

    Figure 5-1 Edit Application Descriptor MicroEdition-Profile Setting

    Description of Figure 5-1 follows
    Description of "Figure 5-1 Edit Application Descriptor MicroEdition-Profile Setting"

5.2 Project Properties

To view the project properties, right-click a project, click Properties, and select the Java ME category. The Java ME category enables you to select the emulator platform and configuration for the project, and it contains the following subcategories: Library, Obfuscation, Packaging, Preprocessor, Preverification and Signing.

5.3 Platform Selection

An emulator platform simulates the execution of an application on one or more target devices. To view this property page, right-click a project and click Properties and select the Java ME category.

Select a configuration from the table. You can edit the configuration and choose the SDK platform and the device that you want to use for this project.

For the emulator platform, be sure to select the 3.3 platform. You might have to use the dropdown menu to ensure the right version is selected.

By default, the devices in the device menu are also suitable for the platform type and emulator platform. The device you select is the default device for this project. It is used whenever you use the Run command. Your device selection influences the Device Configuration and Device Profile options, and the available optional packages.

Add the optional packages you want to include in this project. The selected APIs are automatically added to the project's classpath.

5.4 Editing Application Descriptor Properties

In Eclipse, the application descriptor is an element in the Package Explorer window. Double click on Application Descriptor in the Package Explorer under your project tree and edit the properties on the window that appears. There are different categories of properties on the tabs on the bottom: Overview, MIDlets, Optional, User Defined, Signing, and so on.

5.5 Building a Project

When you build a project, the SDK compiles the source files and generates the packaged build output (a JAR file) for your project. You can build the main project and all of its required projects, or build any project individually.

In general you do not need to build the project or compile individual classes to run the project. By default, the SDK automatically compiles classes when you save them. You can use properties to modify the following build tasks:

5.5.1 Compiling

To view this property page, right-click on a project and choose Properties. Choose the Java Compiler category. In this category and its subcategories you can choose the Java compiler options and other compilation options.

5.5.2 Adding Libraries and Resources

To view this property page, right-click a project and choose Properties. In the Java ME category, choose the Library subcategory. Here you can add libraries to your project.

5.5.3 Creating JAR and JAD Files (Packaging)

To view this property page, right-click a project and choose Properties. In the Java ME category, choose the Packaging subcategory.


Note:

In some cases the JAD file might have an incorrect value for MicroEdition-Profile. To fix this problem, see the project procedure in "Projects."


5.5.4 Obfuscating

To view this property page, right-click a project and choose Properties. In the Java ME category, choose the Obfuscation subcategory.

5.5.5 Signing

To view this property page, right-click a project and choose Properties. In the Java ME category, choose the Signing subcategory.

5.6 Running and Debugging Settings

To view this property page, right-click on a project and choose Properties. In the Properties window, choose Run/Debug Settings. The options shown depend on the platform. See "MIDP Project Run Options."

5.6.1 MIDP Project Run Options

To set emulator command line options for a MIDP project, type in the command line switches. See "Emulator Command Line Options."

To view the running settings page, right-click a project and choose Properties. Select the Run/Debug Settings category and click on New. Select Java Application and click OK. In the window that appears you can adjust the run options for your project.

5.6.2 Debugging Options

Use the Eclipse debugging options found in Windows > Preferences > Run/Debug when you start a debugging session. See the Eclipse help topic, "Debugging a program" for explicit information on running a debugging session and available debugging options.

Note that when a debugging session is started for the first time for a Java project, the following warning message might appear:

"There are some problems with your Java Debug settings for MTJ debug. Do you want to fix them?"

Click yes to automatically set the following Java debug preferences:

  • Suspend execution on uncaught exceptions

  • Suspend execution on compilation errors

  • Debugger timeout value (in milliseconds) is set to 15000

    The timeout value must have a value of at 15000 ms.

If any of these items has a different setting, the debugging operation fails. You can set these options manually be going to Windows > Preferences > Java and selecting the Debug node.