| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
| <!-- | |
| Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. | |
| --> | |
| <html> | |
| <head> | |
| <link rel="stylesheet" type="text/css" href="../../../netbeans.css"> | |
| <title>NetBeans Java ME CDC Development Quick Start Guide</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| <meta http-equiv="Content-Style-Type" content="text/css"> | |
| <meta name="SourceCastVersion" content="2.6.2.4.10"> | |
| <meta name="keywords" content="NetBeans, IDE, Platform, open source, developer, Java ME, CDC"> | |
| <meta name="Alyona Stashkova" content="Alyona.Stashkova@oracle.com"> | |
| </head> | |
| <!-- Begin Content Area --> | |
| <body> | |
| <h1>NetBeans Java ME CDC Development Quick Start Guide</h1> | |
| <h2>Introduction</h2> | |
| <p>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. </p> | |
| <!--<p class="notes"><b>Note:</b> If you are using NetBeans 6.8 refer to the <a href="../../68/javame/cdc-quickstart.html">NetBeans 6.8 Java ME CDC Development Quick Start Guide</a>.</p> --> | |
| <h3>Contents</h3> | |
| <img src="../../../images_www/articles/69/netbeans-stamp-69-70-71.png" class="stamp" alt="Content on this page applies to NetBeans IDE 6.9 or later" title="Content on this page applies to the NetBeans IDE 6.9 or later" > | |
| <ul> | |
| <li><a href="#reqs">Requirements</a></li> | |
| <li><a href="#platforms">Adding Emulator Platforms</a></li> | |
| <li><a href="#pbp">Creating a CDC Application with Personal Basis Profile</a></li> | |
| <li><a href="#personal">Creating a CDC Application with Personal Profile</a></li> | |
| <li><a href="#next">See Also</a></li> | |
| </ul> | |
| <h2>Requirements<a name="reqs"></a></h2> | |
| <p><b>To complete this tutorial, you need the following software and resources:</b></p> | |
| <table> | |
| <tbody> | |
| <tr> | |
| <th class="tblheader" scope="col">Software or Resource</th> | |
| <th class="tblheader" scope="col">Version Required</th> | |
| </tr> | |
| <tr> | |
| <td class="tbltd1"><a href="https://netbeans.org/downloads/index.html">NetBeans IDE with Java ME</a></td> | |
| <td class="tbltd1">Version 6.9 or later</td> | |
| </tr> | |
| <tr> | |
| <td class="tbltd1"><a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">Java Development Kit</a> (JDK)</td> | |
| <td class="tbltd1">Version 6 or version 7</td> | |
| </tr> | |
| </tbody> | |
| </table> | |
| <h2> Adding CDC Emulator Platforms<a name="platforms"></a></h2> | |
| <h3>Supported CDC Profiles</h3> | |
| <p>The IDE installer for the Windows operating system includes the <a href="http://java.sun.com/javame/downloads/sdk30.jsp">Java ME SDK 3.0</a> 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:</p> | |
| <ul> | |
| <li>Personal Basis Profile (Sun Java ME SDK ) supports an application development framework for mobile and embedded devices | |
| (<a href="http://java.sun.com/products/personalbasis/index.jsp">more info</a>)</li> | |
| <li>Personal Profile (Nokia, Sony Ericsson) is the most popular profile for smartphone development. (<a href="http://java.sun.com/products/personalprofile/">more info</a>)</li> | |
| </ul> | |
| <h3>Available Platforms</h3> | |
| <p>Instructions for adding the following supported emulator platforms are listed in the <a href="cdcemulator-setup.html"> NetBeans CDC Platform Emulator Setup Guide</a>.</p> | |
| <ul> | |
| <li>Java ME SDK 3.0</li> | |
| <li>Sony Ericsson CDC Platform UIQ SDK 3</li> | |
| <li>Sony Ericsson M600 and P990 devices</li> | |
| <li>Nokia Series 80 Platform SDK for Symbian OS, Java and Personal Profile</li> | |
| <li>NSIcom CrEme VM for Windows CE</li> | |
| </ul> | |
| <p>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. </p> | |
| <h2>Creating a New CDC Application - Personal Basis Profile<a name="pbp"></a></h2> | |
| <p>Here we create a CDC Application for the Personal Basis Profile (PBP) 1.1 Profile using the Java ME SDK 3.0. </p> | |
| <ol> | |
| <li>Choose <tt>File</tt> > <tt>New Project (Ctrl+Shift+N)</tt> from the main window.</li> | |
| <li>From Categories, select <tt>Java ME</tt>. From Projects, select <tt>CDC Application</tt>. | |
| Click Next.</li> | |
| <li>In the Name and Location page, name the project <code>newcdc</code> and leave the <tt>Set as Main Project</tt> and <tt>Create Main Class</tt> checkboxes checked. Click Next.</li> | |
| <li>In the Select Platform page, use the drop-down menus to choose <code>CDC Java(TM) Platform Micro Edition SDK 3.0</code> for the Java Platform and | |
| <code>DefaultCdcPbpPhone1</code> as the Device. Leave the Profile settings as <tt>PBP-1.1</tt> like shown in the following picture. | |
| <p class="align-center"><img src="../../../images_www/articles/72/javame/cdc-quickstart/select-platform.png" alt="New CDC Project Wizard Select Platform Page." border=1> </p> | |
| </li> | |
| <li>Click Finish. The IDE creates the new application and opens the main class form.</li> | |
| <li>In the Source view, find <code>g.drawString("Hello, World!", 80, 50);</code> and add the word <tt>Java</tt> so that it reads <code>Hello, Java World!</code> | |
| <p class="align-center"><img src="../../../images_www/articles/72/javame/cdc-quickstart/hellojava.png" alt="Shows the Source Code editor with the string Hello Java World!" border=1> </p> | |
| </li> | |
| <li>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. | |
| <p class="align-center"><img src="../../../images_www/articles/72/javame/cdc-quickstart/hellojava-emulator.png" alt="Shows the Default Color Phone Device Emulator with the message Hello Java World! displayed" border=1></p> | |
| </li> | |
| </ol> | |
| <p>You can also debug the project and create tests for CDC projects <a href="../../docs/java/junit-intro.html">using the JUnit framework</a>.</p> | |
| <a name="personal"></a> | |
| <h2>Creating a New CDC Application - Personal Profile</h2> | |
| <p>Here we create an <em>applet</em> 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. </p> | |
| <ol> | |
| <li>Choose <tt>File</tt> > <tt>New Project (Ctrl+Shift+N)</tt>. Under Categories, select | |
| <tt>Java ME</tt>. Under Projects, select the <tt>CDC Application</tt> template. Click Next.</li> | |
| <li>Name the project <tt>S80cdcApplication</tt> and specify a location for | |
| the project on your computer. Leave the <tt>Create Main Class</tt> check box selected. | |
| Click Next. | |
| <p class="align-center"><img src="../../../images_www/articles/72/javame/cdc-quickstart/nokias80app.png" alt="New Project Wizard Name and Location showing S80cdcApplication project." border=1> </p> </li> | |
| <li> In the Select Platform Page, choose the <tt>Nokia S80 Platform</tt>. | |
| <p class="align-center"><img src="../../../images_www/articles/72/javame/cdc-quickstart/nokias80sdk.png" alt="" border=1> </p></li> | |
| <li>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 <code>java.awt.Frame</code>. | |
| <p class="align-center"> | |
| <a href="../../../images_www/articles/72/javame/cdc-quickstart/nokia-screen.png" rel="lytebox" | |
| title=""> | |
| <img src="../../../images_www/articles/72/javame/cdc-quickstart/nokia-screen-small.png" | |
| alt="" border=1></a></p> | |
| </li> | |
| </ol> | |
| <h4>Creating the Application Interface Using the GUI Builder</h4> | |
| <p>You can use the GUI Builder in the same way you use it for regular J2SE development. | |
| In the GUI Builder, right-click the <tt>Main.java</tt> form | |
| and choose <tt>Set Layout</tt> > <tt>Free Design</tt>. Then drag and drop components from | |
| the Palette window into the Design Area of the GUI Builder. </p> | |
| <p class="notes"><b>Note:</b> 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.</p> | |
| <p>For more information on using the IDE's GUI Builder, see the <a href="../../trails/matisse.html">Java GUI Applications Learning Trail</a>.</p> | |
| <p> 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.</p> | |
| <p class="align-center"> | |
| <a href="../../../images_www/articles/72/javame/cdc-quickstart/nokia-finished.png" rel="lytebox" | |
| title=""> | |
| <img src="../../../images_www/articles/72/javame/cdc-quickstart/nokia-finished-small.png" | |
| alt="" border=1></a></p> | |
| <p>You can also debug the project, and create and debug tests <a href="../../docs/java/junit-intro.html">using the JUnit framework</a>.</p> | |
| <div class="feedback-box"><a href="/about/contact_form.html?to=6&subject=NetBeans%20CDC%20Development%20Quick%20Start%20Guide">Send | |
| Us Your Feedback</a></div><br style="clear:both;" > | |
| <h2>See Also<a name="next"></a></h2> | |
| <blockquote> | |
| <p>More information about developing mobile applications using the IDE can be found at the following locations:</p> | |
| <ul> | |
| <li><a href="cdcemulator-setup.html">NetBeans CDC Emulator Platform Setup Guide</a></li> | |
| <li><a href="../../../kb/trails/mobility.html">NetBeans Java ME Applications Learning Trail</a></li> | |
| </ul> | |
| </blockquote> | |
| </body> | |
| </html> |