NetBeans Java ME CDC Development Quick Start Guide

Introduction

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.

Contents

Content on this page applies to NetBeans IDE 6.9 or later

Requirements

To complete this tutorial, you need the following software and resources:

Software or Resource Version Required
NetBeans IDE with Java ME Version 6.9 or later
Java Development Kit (JDK) Version 6 or version 7

Adding CDC Emulator Platforms

Supported CDC Profiles

The IDE installer for the Windows operating system includes the Java ME SDK 3.0 which 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:

  • Personal Basis Profile (Sun Java ME SDK ) supports an application development framework for mobile and embedded devices (more info)
  • Personal Profile (Nokia, Sony Ericsson) is the most popular profile for smartphone development. (more info)

Available Platforms

Instructions for adding the following supported emulator platforms are listed in the NetBeans CDC Platform Emulator Setup Guide.

  • Java ME SDK 3.0
  • Sony Ericsson CDC Platform UIQ SDK 3
  • Sony Ericsson M600 and P990 devices
  • Nokia Series 80 Platform SDK for Symbian OS, Java and Personal Profile
  • NSIcom CrEme VM for Windows CE

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 Inerface.

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.0.

  1. Choose File > New Project (Ctrl+Shift+N) from the main window.
  2. From Categories, select Java ME. From Projects, select CDC Application. Click Next.
  3. In the Name and Location page, name the project newcdc and leave the Set as Main Project and Create Main Class checkboxes checked. Click Next.
  4. In the Select Platform page, use the drop-down menus to choose CDC Java(TM) Platform Micro Edition SDK 3.0 for the Java Platform and DefaultCdcPbpPhone1 as the Device. Leave the Profile settings as PBP-1.1 like shown in the following picture.

    New CDC Project Wizard Select Platform Page.

  5. Click Finish. The IDE creates the new application and opens the main class form.
  6. In the Source view, find g.drawString("Hello, World!", 80, 50); and add the word Java so that it reads Hello, Java World!

    Shows the Source Code editor with the string Hello Java World!

  7. Click F11 to build the project then F6 to Run Main Project. The project launches in the emulator and and displays the modified "Hello World!" message.

    Shows the Default Color Phone Device Emulator with the message Hello Java World! displayed

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. The Sony Ericsson platform also supports the Personal Profile.

  1. Choose File > New Project (Ctrl+Shift+N). Under Categories, select Java ME. Under Projects, select the CDC Application template. Click Next.
  2. Name the project S80cdcApplication and specify a location for the project on your computer. Leave the Create Main Class check box selected. Click Next.

    New Project Wizard Name and Location showing S80cdcApplication project.

  3. In the Select Platform Page, choose the Nokia S80 Platform.

  4. Click Finish. The IDE creates the 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 that the generated code is based on the profile. In this case, the main class is derived from java.awt.Frame.

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 Project. Your application should be displayed in the Applications menu 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.


See Also

More information about developing mobile applications using the IDE can be found at the following locations:

get support for the NetBeans

Support


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo