Consuming Java .JAR files for BlackBerry Projects

Add the .jar and .cod files to your BlackBerry project.

Using this procedure, the Java definitions are available in Eclipse in order to find the third-party classes when compiling your project's source code. After compilation you will have one .cod file containing the application and the libraries together.

  1. Download the library to your host development system.
  2. Create a new folder, named libs, in your Eclipse/BlackBerry project.
  3. Right click libs and choose Import -> General -> File System, then click Next.
  4. Browse the file system to find the library's parent directory (where you downloaded it).
  5. Click OK, then click the directory name (not the checkbox) in the left pane and check the relevant JAR in the right pane. This puts the library into your project (physically).
  6. Right click on your project, choose Build Path -> Configure Build Path, then click the Libraries tab, then click Add JARs...
  7. Navigate to your new JAR in the libs directory and add it.
  8. Click on the Order and Export tab. After you added the libraries they should be listed. Check all the libraries. This way the libraries will be compiled together with the application and packaged into one .cod file.
    Note: The following .jar files should not be marked as 'Exported' in the build path:
    • CommonClientLib.jar
    • MessagingClientLib.jar
    • MocaClientLib.jar
    • sup_json.jar

    The .cod files corresponding to these .jar files have to be deployed on the device while installing the application.