Would you like to tell us how we are doing?

You bet No thanks

Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

Building your app

To build applications automatically, on the Project menu, click Build Automatically. Each time you save resources in a project, an incremental build occurs.

Specifying preprocessor directives

You can specify preprocessor directives that are used to preprocess your Java source files before they are passed to the Java compiler. You can specify preprocessor directives for a single project or for all projects in a workspace. You must turn on preprocessing in Eclipse before you can specify preprocessor directives. For more information about how to turn on preprocessing, see Turn on application preprocessing.

Directive

Description

//#preprocess

This directive specifies that a file must be preprocessed. This directive must be the first line in a .java file.

//#ifdef tag ... #else ... #endif

This directive specifies that the block before the else is compiled if tag is specified. Otherwise, only the block after the else is compiled.

//#ifndef tag ... #else ... #endif

This directive specifies that the block before the else is compiled if tag is not specified. Otherwise, only the block after the else is compiled.

If you have not turned on preprocessing, before you specify preprocessor directives you are prompted to restart Eclipse.

Create preprocessor directives for a workspace

You must turn on preprocessing in Eclipse before you can specify preprocessor directives. For more information about how to turn on preprocessing, see Turn on application preprocessing.

The preprocessor directives that you create are defined for all projects in the workspace.

  1. On the Window Eclipse menu, click Preferences.
  2. Expand the BlackBerry Java Plug-in item and click Build.
  3. In the Preprocessor Defines dialog box, add, remove, or edit directives.
  4. Click OK.

Create preprocessor directives for a project

You must turn on preprocessing in Eclipse before you can specify preprocessor directives. For more information about how to turn on preprocessing, see Turn on application preprocessing.

  1. In the Package Explorer view, right-click a BlackBerry project and click Properties.
  2. Click BlackBerry Project.
  3. Click Application Descriptor.
  4. Click the Build tab.
  5. In the Preprocessor Directives dialog box, type the preprocessor directives for your project.
  6. On the Eclipse toolbar, click Save.

Packaging a BlackBerry application project

When you package a BlackBerry application project, you create the files that you install on a BlackBerry device (for example .cod files and .alx files). When you package a BlackBerry application project, you trigger an incremental Java build, and you also repackage the applications that depend on the BlackBerry application project. If your application uses protected BlackBerry APIs, you can invoke the BlackBerry Signature Tool automatically after packaging.

For more information about the output files that are created when you package your application, see Packaging and distributing your apps.

Package a BlackBerry application project manually

If you make changes to your application that do not trigger packaging automatically (for example if you change the BlackBerry_App_Descriptor.xml file) you can package your application manually.

  1. In Package Explorer view, right-click a BlackBerry project.
  2. Click BlackBerry > Package Project(s).

The Console view displays the progress of packaging.