Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Compile a jar file into a BlackBerry Library

by Retired ‎02-16-2010 09:23 AM - edited ‎02-18-2010 12:18 PM (4,585 Views)

Summary


This article applies to the following:


  • BlackBerry® wireless devices based on Java™
  • BlackBerry Java Development Environment (JDE)


Details


You can include classes from other compiled JAR files in your application. To include these files, save the JAR file in a new project in the same workspace as your application. Make this new project a library application and make your application dependent on this library. You can then import all of its classes. The following steps make up this procedure.


To create a new project


  1. Open the workspace that contains your application's project.
  2. Create a new project.

To add a compiled JAR file to the project


  1. In the navigation pane, select the project.
  2. On the Build menu, select Project > Add File to Project.
  3. Select the appropriate JAR file and click Open.

To make the project a library


  1. In the navigation pane, select the project.
  2. Right-click and select Properties. The <Project name> Class Properties window appears.
  3. Click the Application tab.
  4. From the Project Type drop-down list, select Library.

To compile the project


  1. In the navigation pane, select the project.
  2. Right-click and click Build Project.

To make the project dependent on the new library


  1. In the navigation pane, select the project.
  2. Right-click and click Project Dependencies. The Class depends on <Project name:> window appears.
  3. Select the <Project name> check box.

Your application can now import the classes in this JAR file with the import “xxx.yyy.*” command.

Contributors
Users Online
Currently online: 13 members 2,180 guests
Please welcome our newest community members: