Sie sind auf Seite 1von 5

2/20/13

NetBeans Java ME CDC Development Quick Start Guide

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. Note: If you are using NetBeans IDE 6.9, 7.0, or 7.1, refer to the NetBeans 6.9, 7.0, or 7.1 Java ME CDC Development Quick Start Guide.

Contents
Requirements Supported CDC Emulator Platforms Creating a CDC Application with Personal Basis Profile Creating a CDC Application with Personal Profile See Also

Requirements
To complete this tutorial, you need the following software and resources: Software or Resource Version Required

NetBeans IDE with Java ME Version 7.2 Java Development Kit (JDK) Version 6 or version 7

Supported CDC Emulator Platforms


The IDE installer for the Windows operating system includes the Java ME SDK 3.0.5 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) is the most popular profile for smartphone development (more info) Note: Instructions for adding the Nokia Series 80 Platform SDK for Symbian OS, Java and Personal Profile emulator platform are listed in the NetBeans CDC Platform Emulator Setup Guide. 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.
netbeans.org/kb/docs/javame/cdc-quickstart.html?print=yes 1/5

2/20/13

NetBeans Java ME CDC Development Quick Start Guide

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.5. 1. Choose F i l e> N e wP r o j e c t( C t r l + S h i f t + N )from the main window. 2. From Categories, select J a v aM E . From Projects, select C D CA p p l i c a t i o n . Click Next. 3. In the Name and Location page, name the project n e w c d cand leave the C r e a t eM a i n

C l a s scheckbox checked. Click Next.


4. In the Select Platform page, use the drop-down menus to choose C D CJ a v a ( T M )

P l a t f o r mM i c r oE d i t i o nS D K3 . 0 . 5for the Java Platform and D e f a u l t C d c P b p P h o n e 1as the Device. Leave the Profile settings as P B P 1 . 1like
shown in the following picture.

5. Click Finish. The IDE creates the new application and opens the main class form. 6. In the Source view, find g . d r a w S t r i n g ( " H e l l o ,W o r l d ! " ,8 0 ,5 0 ) ;and add the word J a v aso that it reads H e l l o ,J a v aW o r l d !

7. To build the project, choose Run > Build Project from the main toolbar. 8. 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.

netbeans.org/kb/docs/javame/cdc-quickstart.html?print=yes

2/5

2/20/13

NetBeans Java ME CDC Development Quick Start Guide

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 F i l e> N e wP r o j e c t( C t r l + S h i f t + N ) . Under Categories, select J a v a

M E . Under Projects, select the C D CA p p l i c a t i o ntemplate. Click Next.


2. Name the project S 8 0 c d c A p p l i c a t i o nand specify a location for the project on your computer. Leave the C r e a t eM a i nC l a s scheck box selected. Click Next.

3. In the Select Platform Page, choose the N o k i aS 8 0P l a t f o r m .


netbeans.org/kb/docs/javame/cdc-quickstart.html?print=yes 3/5

2/20/13

NetBeans Java ME CDC Development Quick Start Guide

4. 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 j a v a . a w t . F r a m e .

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 M a i n . j a v aform and choose S e tL a y o u t> F r e eD e s i g n . 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
netbeans.org/kb/docs/javame/cdc-quickstart.html?print=yes 4/5

2/20/13

NetBeans Java ME CDC Development Quick Start Guide

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. Send Feedb ack on This Tutorial

See Also
More information about developing mobile applications using the IDE can be found at the following locations: NetBeans CDC Emulator Platform Setup Guide NetBeans Java ME Applications Learning Trail

netbeans.org/kb/docs/javame/cdc-quickstart.html?print=yes

5/5

Das könnte Ihnen auch gefallen