Sun GlassFish Mobility Platform 1.1 Developer's Guide for Client Applications

ProcedureTo Create a New BlackBerry Project to Use the MCBO API

To create a new NetBeans IDE project that uses the MCBO API, follow these steps.

  1. In NetBeans IDE, choose New Project from the File menu.

  2. Choose Project Screen.

  3. Click Java ME->MIDP Application.

  4. Click Next.

  5. In the Name and Location screen:

    1. Type a name for the project or keep the default name.

    2. Select Set as Main Project.

    3. Select Create Hello MIDlet.

    4. Click Next.

  6. In the Default Platform Selection Screen:

    1. Specify BlackBerryJDE421 as the Emulator Platform.

    2. Specify 8800 as the Device.

    3. Click Finish.

  7. Add the mep_client_api.jar and jerseyme_api.jar files to your Libraries & Resources for this project in order to call and have access to the MCBO API.

    1. If you have not done so before, go to http://www.sun.com/software/products/mep/get.jsp and download the sgmp-client-1_1_01-fcs-b02.zip bundle.

    2. Unzip the sgmp-client-1_1_01-fcs-b02.zip bundle (for example, under C:\).

    3. In NetBeans IDE, right-click the project and select Properties.

    4. Click Libraries & Resources.

    5. Click Add Jar/Zip.

    6. Browse to the location of the unzipped bundle above the lib directory to add mep_client_api.jar.

      For example, if you unzipped the bundle to the C:\ directory, the file name would be C:\sgmp-client-1_1_01-fcs-b02\lib\BlackBerry\mep_client_api.jar.

    7. From the same location, add jerseyme_api.jar.

    8. Click OK.

    9. Click the Files Tab (next to the Projects tab) and open the project.properties file under the nbproject directory.

    10. Edit the file.reference.mep_client_api.jar property to contain the fully qualified path name of the mep_client_api.jar file.

      For a BlackBerry project, the pathname must be absolute, not relative.

      For example, if you unzipped the bundle to the C:\ directory, edit the property setting to look like this:

      file.reference.mep_client_api.jar=C:/sgmp-client-1_1_01-fcs-b02/lib/BlackBerry/mep_client_api.jar

      Use forward slashes (/) instead of the usual Windows file separator.

    11. Edit the file.reference.jerseyme_api.jar property to contain the fully qualified path name of the jerseyme_api.jar file.

      For example, if you unzipped the bundle to the C:\ directory, edit the property setting to look like this:

      file.reference.jerseyme_api.jar=C:/sgmp-client-1_1_01-fcs-b02/lib/BlackBerry/jerseyme_api.jar
    12. Click the Files Tab and open the project's build.xml file. Immediately before the </project>tag at the end of the file, add the same code fragment you added in Step 11 of To Import the SecureMusicDB Sources into NetBeans IDE as a BlackBerry Project.

  8. Create an .alx file for this project:

    1. Click the Files tab.

    2. Right-click your project and select New->Other.

    3. In the Choose File Type screen, click Other, then click Empty File.

    4. Click Next.

    5. Give the file the same name as your project name, with the .alx extension.

    6. Click Finish.

    7. Copy and paste into the file the content from Step g under Step 12 of To Import the SecureMusicDB Sources into NetBeans IDE as a BlackBerry Project, replacing myProject with your project name.

    8. Save and close the file.

  9. Copy the files mep_client_api.cod and jerseyme_api.cod from the directory C:\sgmp-client-1_1_01-fcs-b02\lib\BlackBerry to the simulator directory of the BlackBerry JDE (for example, C:\Program Files\Research In Motion\BlackBerry JDE 4.2.1\simulator).

  10. Click the Projects tab, then right-click your project and select Clean & Build.

  11. Right-click your project and select Run.

    The BlackBerry Device Simulator appears.


    Note –

    When you select Run, NetBeans IDE automatically loads the application on the Simulator using the .jad and .jar files (not the .cod file). To load the application from the .cod file created, use the Load Java Program option in the Simulator.


  12. Launch the MIDlet application.

Next Steps

At this point, you have a boilerplate application that says Hello World. You can now add code to implement and call the MCBO API classes and methods, and you can edit the MIDlet code to provide a user interface and to perform synchronizations.