FeaturesPluginsDocs & SupportCommunityPartners

Deploying Mobile CDC Applications Using the CrEmeVM in NetBeans

Introduction

CDC application 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 128 to 512KB of memory and use the Connected Limited Device Configuration (CLDC).

This document shows you how to use NetBeans IDE to create a Java Platform, Micro Edition (Java ME platform), Connected Device Configuration (CDC) application. We show you four different ways to create a Java ME CDC project that displays a simple form in a device emulator, one for each available profile. We also show an additional way using the NSICom CrEme VM for Windows CE. This document is designed to get you creating applications as quickly as possible.

Contents

Content on this page applies to NetBeans IDE 6.0 and 6.1

Requirements

You must have the NetBeans IDE 6.0 or 6.1 Mobility or Full edition (download) installed before you can start Java ME CDC development.

  • Sun Java Toolkit for CDC or other CDC emulator platform installed and registered in the IDE. See Adding Emulator Platforms section for more information.

Adding Emulator Platforms

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

The following emulator platforms and tools are required for this tutorial:

  • Sun Java Toolkit for CDC 1.0. ( see installation instructions)
  • CrEme VM for Windows CE
  • Windows CE Device emulator and supporting images
  • ActiveSync

Creating a New CDC Application for Windows CE (Using the CrEme VM)

The NSIcom CrEme VM enables you to create and run Java Swing applications for devices running Windows CE.

Creating an Application

  1. Choose File > New Project (Ctrl+Shift+N) from the main window.
  2. Under Categories, select CDC. Under Projects, select the CDC Application template. Click Next.
  3. In the Name and Location Page, name the project cremeapp. Click Next.
  4. In the Select Platform Page, choose pJSCP V4.10. Click Finish.
  5. In the Explorer window, right-click on the Source Packages node of your project and choose New > JFrame form. Click Finish. The NetBeans GUI Builder (Matisse) displays the new form.

    Note: Make sure that the first fragment of code in the main() method is as is shown below when you are going to run the application in CrEme default emulator. This make sure that Swing is loaded.

    try {
        UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());} catch(Exception exception) {
        System.out.println("Error loading L&F: " + exception);
    } 
  6. Use the Project Matisse GUI builder to create your application. You can use the Project Matisse GUI Builder in the same way you use it for regular J2SE development.

    Note that if there is an exception that crashes the emulator, the emulator prints it to the standard output window and waits for a key press. You cannot, however, send the keypress from the IDE. You must instead kill the VM from the Process Explorer.

Compiling and Running the Application on a Device or Emulator

  1. Connect your mobile device using cable or Bluetooth. If you have a device, skip to Step 12. If you do not have a device, install the Microsoft Device Emulator and the Virtual Machine Network Driver for the Microsoft Device Emulator as described in the NetBeans Mobility Pack for CDC 5.5.1 Installation Guide. Then follow steps 2 through 4. If you do have a device, skip to Step 5.
  2. Start the Microsoft Device Emulator by choosing Start > Programs > Microsoft Windows Mobile 5.0 MSFP Emulator Images > Pocket PC Coldboot. This opens the Pocket PC emulator.
  3. Choose Start > Programs > Microsoft Windows Mobile 5.0 MSFP Emulator Images > Device Emulator Manager. This opens the Device Emulator Manager.
  4. In the Device Emulator Manager, choose Actions > Cradle.
  5. Open ActiveSync by clicking on the icon in the Application tray. If you do not have ActiveSync installed, download and install it as described in the NetBeans CDC Emulator Platform Setup Guide. When you open ActiveSync, it detects and connects to the device or the device emulator. If it does not:
    1. Click on the ActiveSync icon in the Application Tray.
    2. Choose File > Connection settings.
    3. Do one or both of the following:
    • Check the Allow connections to one of the following check box and select DMA for the emulator, or USB or port number for a real device.
    • Choose Run Connect which should detect the device automatically.
  6. Download and install the CrEme VM on your device (download). Double-click on the downloaded file. It install both on your PC and your device.
  7. Download and install Swing extensions (CrE-ME410_swing.CAB) for your device from NSIcom (download). To install the Swing extensions on your device or device emulator:
    1. In the ActiveSync dialog, choose Tools > Explore Device. The Mobile Device opens in an Explorer window.
    2. Copy CrE-ME410_swing.CAB into the Explorer window.
    3. In the device or device emulator, choose Start > Programs > File Explorer.
    4. Start CrE-ME410_swing.CAB.

Running the Application

  1. Right-click the project and choose Properties. The Properties page opens.
  2. Under Categories, choose Running.
  3. Choose the NSIcom tab and check Run in remote VM. Click OK to close the Properties page.
  4. Choose Run > Run Main Application.

See Also

In addition to the IDE's built-in help documentation about Java ME CDC development, tutorials and articles about using NetBeans for mobile development can be found at the following location:

Bookmark this page

del.icio.us furl simpy slashdot technorati digg
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Open ESB - The Open Enterprise Service Bus Powered by