NetBeans Java ME CDC Development Quick Start Guide
Connected Device Configuration (CDC) applications are designed to run on mobile and embedded devices with at least 2MB of memory. This configuration supports
a more feature-rich JVM than MIDP-based mobile phones, which typically have much less memory and use the Connected Limited Device Configuration (CLDC). This tutorial shows you how to use NetBeans IDE to create a Java Platform, Micro Edition (Java ME platform) CDC application. We show you how to create a Java ME CDC project that displays a simple form in a device emulator for the three available CDC profiles. This document is designed to get you creating applications as quickly as possible.
To complete this tutorial, you need the following software and resources:
Supported CDC Emulator Platforms
The NetBeans IDE supports the Java ME SDK 3.2 for the Windows operating system. The Java ME SDK 3.2 allows you to develop CDC applications.
Note that different CDC emulator platforms support different development profiles. The main development profiles and the emulators that support them are:
Installing Oracle Java ME SDK (on Windows)
- Go to the Java ME SDK Download page.
- Click the Accept License Agreement option.
- Download the oracle_java_me_sdk-3_2.exe installer file and save it to any location on your computer.
- Double-click the installer file to run the installer, and follow the instructions.
When the installation is complete, the Java (TM) ME Platform SDK 3.2 Device Manager icon () appears in the Windows system tray.
Installing Oracle Java ME CDC Platform
- Choose Tools > Java Platforms.
The Java Platform Manager dialog box displays.
- Click Add Platform.
- In the Select Platform Type step of the Add Java Platform wizard, select Java ME CDC Platform Emulator and click Next.
The IDE displays the Choose Platform Folder step.
- Select the directory you installed the Java ME SDK Platform to (for example, C:\Java_ME_Platform_SDK_3.2) and click Next.
- In the Platform Name panel of the Add Java Platform wizard, ensure the platform you selected in the previous step is chosen and click Finish.
The Oracle Java ME CDC Platform is now registered in the Netbeans IDE.
- In the Java Platform Manager dialog box, click Close.
Activating Java ME
- Choose Tools > Plugins from the main IDE's toolbar.
- In the Plugins dialog box, click the Installed tab and select Java ME in the list of available features.
- Click Activate.
At the Welcome panel of the Installer dialog box, click Activate.
- When the activation is successfully completed, click Finish.
- Click Close to close the Plugins dialog box.
Now your NetBeans IDE is set up for mobile development.
In the following sections we create a CDC project using each available profile and also use the IDE's GUI builder in the Personal
and AGUI profile applications to enhance the User Interface.
Creating a New CDC Application - Personal Basis Profile
Here we create a CDC Application for the Personal Basis Profile (PBP) 1.1 Profile using the Java ME SDK 3.2.
- Choose File > New Project (Ctrl+Shift+N) from the main window.
- From Categories, select Java ME. From Projects, select CDC Application.
- In the Name and Location page, name the project
newcdc and leave the Create Main Class checkbox checked. Click Next.
- In the Select Platform page, leave the default settings -
CDC Java(TM) Platform Micro Edition SDK 3.2 (Java Platform),
DefaultCdcPbpPhone1 (Device), and PBP-1.1 (Profile) - like shown in the following picture.
- Click Finish. The IDE creates a new application and opens the main class form.
- In the Source view, find
g.drawString("Hello, World!", 80, 50); and add the word Java so that it reads
Hello, Java World!
- To build the project, choose Run > Build Project from the main toolbar.
- Choose Run > Run Project from the main toolbar to run your project.
The project launches in the emulator and and displays the
modified "Hello World!" message.
You can also debug the project and create tests for CDC projects using the JUnit framework.
Creating a New CDC Application - Personal Profile
Here we create an applet for the Personal Profile using the Nokia
Series 80 Platform SDK for Symbian OS, for Java, Personal Profile.
- Choose File > New Project (Ctrl+Shift+N). Under Categories, select
Java ME. Under Projects, select the CDC Application template. Click Next.
- Name the project S80cdcApplication and specify a location for
the project on your computer. Leave the Create Main Class check box selected.
- In the Select Platform Page, choose the Nokia S80 Platform.
- Click Finish. The IDE creates a new application and opens the main class
form in the GUI Builder, as shown in the following figure. Click on Source
to see the source code for the applet.
Note: The generated code is based on the profile. Here the main class is derived from
Creating the Application Interface Using the GUI Builder
You can use the GUI Builder in the same way you use it for regular J2SE development.
In the GUI Builder, right-click the Main.java form
and choose Set Layout > Free Design. Then drag and drop components from
the Palette window into the Design Area of the GUI Builder.
Note: Make sure you
only use AWT components in your form. Since all the Nokia Series 80
devices support the Personal Profile, only AWT widgets are available.
For more information on using the IDE's GUI Builder, see the Java GUI Applications Learning Trail.
When you are done, right-click the project in the Projects window and
choose Run from the popup menu. Your application should be displayed in the device emulator.
You can now run the device in the emulator.
You can also debug the project, and create and debug tests using the JUnit framework.
More information about developing mobile applications using the IDE can be found at the following locations: