Importing Java ME Projects
See Also
There are four project templates you can use to import
a Java ME MIDP project:
- Each MIDP project supports only a single source
root. If the project you are importing has multiple source roots, you need
to create one project for each source root and then create dependencies
between the projects.
To import a Sun Java Wireless Toolkit project:
- Choose File > New
Project.
- Under Categories, select Java ME. Under Projects, select Import Wireless
Toolkit Project and click Next.
- In the Specify WTK Toolkit project page, browse to select 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.
To import a Java ME project from existing MIDP
sources:
- Choose File > New
Project.
- Under Categories, select Java ME. Under Projects, select Mobile Project
with Existing MIDP Sources and click Next.
- Use the Specify 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 device performance
when the project is executed. Click Finish.
To Import an Antenna Project:
The NetBeans Java ME 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 Java ME. Under Projects, select Mobile Project
with 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, for the following line of code in the
build.xml
file:
<wtkpreprocess srcdir="src" destdir="src_colorphone"
symbols="colorphone,JSR185,JSR172," verbose="true"/>
you would create a configuration for the symbol (mobile device) "colorphone."
- 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 (mobile device) listed in the
build.xml
file, in this case "colorphone". 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 non-device symbols listed in your
build.xml
file.
For example, if you are in the colorphone
configuration
and the build.xml
file has the code
<wtkpreprocess 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.
- The
#include
directive is not supported by the Java ME preprocessor.
Instead, the preprocessor inserts "hints" that identify the files that need
to be inserted into the source code. For example, the Antenna code
//#include ConverterMIDlet.java
is identified in the source code editor as:
You can now build and run your applications in the IDE.
To import a project created in Mobility Pack for
CDC 5.5:
- Choose File > New Project.
- Under Categories, select Java ME. Under Projects, select Import Import
CDC Pack 5.5 Project and click Next.
- In the Specify CDC Pack 5.5 project page, browse to select 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 Finish.
- To test the Project, right-click the project node in the projects tab, and
choose Run Project.
To import a project created with the Sun Java
Toolkit for CDC:
- Choose File > New Project.
- Under Categories, select Java ME. Under Projects, select Import CDC Toolkit
Project and click Next.
- In the Specify CDC Toolkit project page, browse to select 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.
- See Also
- Working with Projects
- Java ME MIDP Project and File Templates
- About Project Configurations
- About Preprocessing
Legal Notices