Importing Existing Java ME MIDP/CLDC Source Code into NetBeans IDE 5.5

Requirements

You must have NetBeans IDE 5.5 and the NetBeans Mobility Pack 5.5 installed before you can start Java ME MIDP/CLDC development.

Note: Projects created with the Visual Mobile Designer in earlier versions of the Mobility Pack will be upgraded to a new format when opened in version 5.5. Once saved, they can not be opened in earlier versions of the Mobility Pack. For specific details, see http://wiki.netbeans.info/wiki/view/MobilityVisualDesignerVersions.


Project Templates

There are three project templates you can use to import a Java ME MIDP project:

Using the Import J2ME Wireless Toolkit Template

  1. Choose File > New Project (Ctrl-Shift-N).
  2. Under Categories, select Mobile. Under Projects, select Import Wireless Toolkit Project and click Next.
  3. In the Specify WTK Toolkit project page, Choose the project you want to import. Click Next.
  4. In the Project Name and Location page, choose a home and a location for the new project. If you want the project to be your main project, leave the Set as Main Project check box checked. Click Next.
  5. Use the Platform Selection page to set the emulator platform that the IDE will use to compile and run the project. Click Finish.
  6. To test the Project, right-click the project node in the projects tab, and choose Run Project.

Using the Import Mobility Studio Project Template

  1. Choose File > New Project (Ctrl-Shift-N).
  2. Under Categories, select Mobile. Under Projects, select Import Mobility Studio Project and click Next.
  3. Use the Specify Suite page to locate the MIDlet suite you want to import. Mobility project definition files have the extension .adcontent. Click Next.
  4. Use the Project Name and Location page to define a new name and location for your NetBeans project. Click Next.
  5. Use the Platform Selection page to select the platform emulator that will be used to emulate the target device when the project is executed. Click Finish.

Using the Mobile Project from Existing MIDP Sources Template

  1. Choose File > New Project (Ctrl-Shift-N).
  2. Under Categories, select Mobile. Under Projects, select Mobile Project from Existing MIDP Sources and click Next.
  3. Use the Specify MIDP Sources page to locate the source directory for the source code and .jad file you want to import. Click Next.
  4. Use the Project Name and Location page to define a new name and location for your NetBeans project. Click Next.
  5. Use the Platform Selection page to select the platform emulator that will be used to emulate the target device when the project is executed. Click Finish.

Using the Mobile Project from Existing MIDP Sources Template to Import Antenna Projects

The Mobility Pack preprocessor is almost fully compatible with the Antenna preprocessor, so you can import Antenna projects and preserve the preprocessing code from the original project.

To import an Antenna project, follow these steps.

  1. Create a new project
    1. Choose File > New Project (Ctrl-Shift-N).
    2. Under Categories, select Mobile. Under Projects, select Mobile Project from Existing MIDP Sources and click Next.
    3. Use the Specify MIDP Sources page to locate the source directory for the source code and (optionally) the .jad file you want to import.
    4. Click Next. Use the Project Name and Location page to define a new name and location for your NetBeans project. Click Finish.
  2. Create project configurations for each of the symbols (mobile devices) listed in your original project. For example, if your Antenna build.xml file has the code <preprocess srcdir="src" destdir="src_colorphone" symbols="colorphone,JSR185,JSR172," verbose="true"/>, use "colorphone" as a name for project configuration.
    1. In the Projects view, right click on the project node and choose Properties from the pop-up menu.
    2. Click the Manage Configurations button.
      This opens the the Project Configuration Manager.
    3. Click the Add button.
      This opens the Add Project Configuration dialog.
    4. Add the name of a symbol listed in the build.xml file. Be sure to match the symbol names precisely. Click OK to create the configuration.
    5. Repeat as necessary.
  3. Add abilities to each configuration.
    1. In the Properties window, under Categories, click the Abilities node.
    2. Uncheck the Use Values from "DefaultConfiguration" check box.
    3. Click the Add button and add abilities for each configuration so that they correspond to the symbols listed in your build.xml file.
      For example, if you are in the colorphone configuration and the build.xml file has the code
      preprocess srcdir="src" destdir="src_colorphone" symbols="colorphone,JSR185,JSR172," verbose="true"/>
      you would add abilities for JSR185 and JSR172.
    4. Delete excess abilities that have nothing to do with the antenna sources just imported.

You can now build and run your applications in the IDE.

Note: The only directive which is excluded is the #include directive. However there is a tool available to directly insert these include files into the source code in the editor. See the online help for more details.


Copyright and Trademark Notice