Documentation



Oracle Java Micro Edition Software Development Kit Developer's Guide

7 About Java ME Embedded Devices

Java ME Embedded applications run on small devices, with either a simple or no display at all, with low power consumption, and with limited network connectivity. Target devices include wireless modules, smart meters, industrial controllers, home automation systems, and so on.

Oracle Java ME SDK includes the Java ME Embedded runtime as a device emulation environment for Windows desktop computers. The emulation environment uses the same code base that Oracle licenses to device manufacturers for use on real devices. This enables you to perform extensive testing of your embedded applications on an emulated device before deploying them on a real device.

By default, Oracle Java ME SDK includes two generic emulated devices (EmbeddedDevice1 and EmbeddedDevice2), and an emulation of the Qualcomm Internet-of-Everything (IoE) embedded device (Qualcomm_IoE_Device). For more information about the Qualcomm IoE device, see Oracle Java ME Embedded Getting Started Guide for the Reference Platform (Qualcomm IoE).

You can also use Oracle Java ME SDK to connect a real external device and run your Java ME Embedded application on it. In this case, the Java ME Embedded Emulator provides an implementation of the device's APIs for testing, logging, and debugging using the tools available with Oracle Java ME SDK.

7.1 Managing Devices

During development, you may be required to run your Java ME Embedded application on several emulated and real devices. Oracle Java ME SDK includes the Device Manager to facilitate you with managing all the various devices.

The Device Manager is a Windows process named device-manager.exe that starts automatically and always runs in the background after you install Oracle Java ME SDK. The Device Manager automatically detects and registers all available emulated devices. It also allows you to connect and register external devices (see Section 7.2, "Connecting an External Device").

When the Device Manager is running, you can see its icon in the notification area of the Windows taskbar. To stop the Device Manager, right-click its icon and select Exit. To start the Device Manager manually, run the device-manager.exe file under bin in the Oracle Java ME SDK installation directory.

To see the list of registered devices, right-click the Device Manager icon and select Registered Devices. This list contains details about emulated and real external devices that were registered by the Device Manager and are available to Oracle Java ME SDK.

If you have multiple instances of Oracle Java ME SDK installed, you should see multiple Device Manager processes running.

When working with Java ME SDK plug-ins for NetBeans IDE, you can switch between the Device Manager processes to define the instance of Oracle Java ME SDK that should be used. To select the active Device Manager process in NetBeans IDE, open the Tools menu, select Java ME, and then make your choice under Active Device Manager.

To define the active instance of Oracle Java ME SDK in Eclipse IDE:

  1. Open the Window menu and select Preferences.

  2. In the left pane, select Device Management under Java ME.

7.2 Connecting an External Device

The Device Manager can detect and register external embedded devices with an active Java ME Embedded runtime on specific IP addresses and serial ports. Device connections are managed in the Device Connections Manager window.

To open the Device Connections Manager window, right click the Device Manager icon in the system tray and select Manage Device Connections. The Device Connections Manager window contains a list of IP addresses and COM ports that the Device Manager scans to detect and register available devices. By default, there are no IP addresses or COM ports in the list.

To add a connection that you would like the Device Manager to scan, click Add. You can add a connection by IP address, host name, or COM port. If there are no serial ports on you computer, then the COM Port option is not available. You can enter an IP address, host name or COM port explicitly, or select it from the corresponding drop-down list. The drop-down lists contain IP addresses on your network and COM ports where the Device Manager detected a running instance of the Java ME Embedded runtime. To rescan the network and COM ports, click Refresh. After you enter or select an address or COM port, click OK to add it to the list. COM port devices can be automatically added to the Device Connections Manager window if an option to automatically establish connection is turned on.

All connections in the Device Connections Manager list have one of the following statuses:

  • Connecting: Means that the Device Manager is attempting to establish a connection and register the device with Oracle Java ME SDK. This is the initial status for any newly added connection.

  • Connected: Means that the Device Manager registered the device with Oracle Java ME SDK. If there are several instances of the Java ME Embedded runtime started on the device, each one is added as a separate device.

  • Busy: Means that the device is already registered with another Oracle Java ME SDK.

  • Wrong Runtime: Means that the device is running a version of the Java ME Embedded runtime that is not supported by the current version of Oracle Java ME SDK.

Click Setup new device to install Java ME Embedded Runtime on your Raspberry Pi or Freescale FRDM-64K board.

Click Options and check the Establish Connection check box to enable automatically connection to COM port devices.

To remove a connection from the list in the Device Connections Manager window, select it and click Remove.

7.2.1 Troubleshooting Device Connection Issues

If the IP address of a device with a running Java ME Embedded runtime instance is not available in the corresponding drop-down list when adding a device connection, see the Device Manager log file. It is located under logs in the Oracle Java ME SDK configuration directory.

The Device Connection log file (device-manager.log) contains errors, warnings, and informational events that you can review in order to find the cause of the problem. The following are some of the common messages that you may encounter:

WARN - .vmagent.proxy.DeviceDetection - UDP device detection failed java.net.BindException: Address already in use: Cannot bind
Cause: The device detection ports are used by another application on the host computer. By default, these ports are 55208 and 55209.
Action: The best solution is to stop the application that uses these ports or configure it to use different ports.

Alternatively, you can configure the device and Device Manager to use different ports as follows:

  1. Change the ports specified by the proxy.udp_device_detection_request_port and proxy.udp_device_detection_response_port properties in jwc_properties.ini on the device.

  2. Create a file named proxyOptions.txt under toolkit-lib/lib in the Oracle Java ME SDK installation directory and add the following line to it:

    -bcastports <request> <response>
    

    The <request> and <response> port numbers must match those specified in the device properties (see Step 1).

7.3 Creating and Managing Custom Emulated Devices

By default, Oracle Java ME SDK includes two generic emulated devices (EmbeddedDevice1 and EmbeddedDevice2), and an emulation of the Qualcomm Internet-of-Everything (IoE) embedded device (Qualcomm_IoE_Device). You can use the Custom Device Editor to create and manage custom emulated devices.

The appearance of a custom emulated device is generic, but the functionality can be configured according to your specifications. Each emulated device should have a name and optionally a description. By default, Oracle Java ME SDK 8.2 supports devices based on the MEEP 8.0 profile and the CLDC 1.8 configuration. You can define the set of optional packages that the emulated device should support, as well as various protocols and interfaces that the device should emulate (for example, the pins and ports, channels, pulse counters, and other features).

You must have a write access to the Java ME installation directory to be able to use the Custom Device Editor. To start the Custom Device Editor, run the device-editor.exe file under bin in the Oracle Java ME SDK installation directory.

Alternatively, if you have the Java ME SDK plug-ins installed, you can start the Custom Device Editor in the IDE.

To start the Custom Device Editor in NetBeans IDE:

  • Open the Tools menu, select Java ME, and then Custom Device Editor.

To start the Custom Device Editor in Eclipse IDE:

  • Open the Run menu and select Custom Device Editor.

The Custom Device Editor contains a list of custom emulated devices that are available, separated by platform. Oracle Java ME SDK 8.2 supports only the Java ME Embedded Profile (MEEP) platform. The three default emulated devices cannot be customized by the user, so initially the list is empty.

The Custom Device Editor maintains configurations of custom devices, referred to as device skins. Each skin is a directory with files, which you can export into a ZIP file for backup or if you need to transfer it to another instance of Oracle Java ME SDK. The Custom Device Editor can then be used to import the ZIP file with the skin to create the custom device defined by the skin.

Caution:

You should manage custom device skins only using the Custom Device Editor. Do not change the configuration directly in the files.

To create a new custom device, select the platform and click New.

To edit an existing custom device, select it and click Edit.

To create a new custom device by cloning an existing one, select it and click Clone.

To remove a custom device, select it and click Remove.

To import a custom device defined by its skin, click Import and select the corresponding ZIP file.

To export a custom device skin as a ZIP file, select the device and click Export.

7.4 Viewing and Editing Device Properties

When the Device Manager registers a device, it appears in the Device Selector, which enables you to view and edit the device properties. You can also use the Device Selector to configure the security settings for an emulated device, and select the device on which to run your Java ME Embedded application.

To start the Device Selector, run the device-selector.exe file on Windows, device-selector on Linux, under bin in the Oracle Java ME SDK installation directory. Alternatively, if you have the Java ME SDK plug-ins installed, you can start the Device Selector as follows:

  • In NetBeans IDE, open the Tools menu, select Java ME, and then Device Selector.

  • In Eclipse IDE, open the Window menu, select Show View, and then Device Selector.

Caution:

You should edit device properties only using the Device Selector. Do not change them directly in the files, where properties are contained.

The Device Selector contains a list of devices that were registered by the Device Manager, grouped by platform. When you select a device, its information and properties are displayed in the corresponding panes.

Tip:

You can also view and edit some of the platform properties.

Properties displayed in gray font or on a gray background cannot be changed. You can adjust properties displayed in black font on a white background.

Close Window

Table of Contents

Oracle Java Micro Edition Software Development Kit Developer's Guide

Expand | Collapse