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
- Choose File > New Project (Ctrl-Shift-N).
- Under Categories, select Mobile. Under Projects, select Import Wireless
Toolkit Project and click Next.
- In the Specify WTK Toolkit project page, Choose the project
you want to import. Click Next.
- 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.
- Use the Platform Selection page to set the emulator platform
that the IDE will use to compile and run the project. Click Finish.
- To test the Project, right-click the project node in the
projects tab, and choose Run Project.
Using the Import Mobility Studio Project Template
- Choose File > New Project (Ctrl-Shift-N).
- Under Categories, select
Mobile. Under Projects, select Import Mobility Studio Project and
click Next.
- Use the Specify Suite page to locate the MIDlet suite you want to
import. Mobility project definition files have the extension
.adcontent
.
Click Next.
- Use the Project Name and Location page to define a new name and location
for your NetBeans project. Click Next.
- 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
- Choose File > New Project (Ctrl-Shift-N).
- Under Categories, select Mobile. Under Projects, select Mobile Project
from Existing MIDP Sources and click Next.
- Use the Specify MIDP Sources page to locate the source directory for
the source code and
.jad
file you want to import.
Click Next.
- Use the Project Name and Location page to define a new name and location
for your NetBeans project. Click Next.
- 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.
- Create a new project
- Choose File > New
Project (Ctrl-Shift-N).
- Under Categories, select Mobile. Under
Projects, select Mobile Project from Existing MIDP
Sources and click Next.
- Use the Specify MIDP Sources page to locate the
source directory for the source code and (optionally)
the .
jad
file
you want to import.
- Click Next.
Use the Project Name and Location
page to define a new name and location
for your NetBeans project. Click Finish.
- 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.
- In the Projects view, right click on the project node and choose
Properties from the pop-up menu.
- Click the Manage Configurations button.
This opens the the Project Configuration Manager.
- Click the Add button.
This opens the Add Project Configuration dialog.
- 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.
- Repeat as necessary.
- Add abilities to each configuration.
- In the Properties window, under Categories, click the Abilities node.
- Uncheck the Use Values from "DefaultConfiguration" check
box.
- 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.
- 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