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
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
- Choose File > New Project (Ctrl+Shift+N) from the main window.
- Under Categories, select CDC. Under Projects, select the CDC Application
template. Click Next.
- In the Name and Location Page, name the project
cremeapp. Click Next.
- In the Select Platform Page, choose pJSCP V4.10. Click Finish.
- 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);
}
-
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
- 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.
- 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.
- Choose Start > Programs > Microsoft Windows Mobile 5.0 MSFP Emulator
Images > Device Emulator Manager. This opens the Device Emulator Manager.
- In the Device Emulator Manager, choose Actions > Cradle.
- 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:
- Click on the ActiveSync icon in the Application Tray.
- Choose File > Connection settings.
- 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.
- 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.
- 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:
- In the ActiveSync dialog, choose Tools > Explore Device.
The Mobile Device opens in an Explorer window.
- Copy
CrE-ME410_swing.CAB into the Explorer window.
- In the device or device emulator, choose Start > Programs > File
Explorer.
- Start CrE-ME410_swing.CAB.
Running the Application
- Right-click the project and choose Properties.
The Properties page opens.
- Under Categories, choose Running.
- Choose the NSIcom tab and check Run in remote VM. Click OK to close the Properties page.
- 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: