The chapter contains the following topics:
Sample applications are installed with the Java ME SDK plug-ins for NetBeans IDE and Eclipse IDE. Additional sample applications may become available through the update center. For more information about installing the plug-ins and the update center, see Setting Up the Development Environment.
The following samples are available by default:
APDU Sample: Demonstrates communication with smart cards using Application Protocol Data Units (APDUs) from JSR 177 - Security and Trust Services API.
Calculator Sample: Calculates several arithmetic expressions concurrently. Demonstrates the following functionality: Multithreading, Service Loader.
Crypto Sample: Demonstrates the general cryptographic features (SATSA-CRYPTO package) of JSR 177 - Security and Trust Services API.
Data Collection Demo: Reads data from peripheral devices using Device Access API (DAAPI) and processes it. Demonstrates the following functionality: MVM, Inter-IMlet communication using local datagrams, Device I/O pulse counter, Device I/O SPI, Logging API.
Data Forwarder Sample: Forwards text data received from a connected TCP client to a set of applications. Demonstrates the following functionality: MEEP IMC, MEEP Events, GCF Server Socket.
Directory Files Tree Sample: Prints the tree of files and directories. Demonstrates a part of CLDC NIO files functionality.
GPIO Sample: Demonstrates usage of GPIO (General Purpose Input Output) package of Device I/O API 1.1.
I2C Accelerometer Sample: Demonstrates simple communication with triaxial accelerometer via I2C using Device I/O API 1.1.
Location Sample: Demonstrates features of JSR 179 - Location API.
Network Info Sample: Displays information about available network interfaces, access points, IP address and host reachability (ping). Demonstrates the following functionality: GCF Network Interfaces, GCF Access Points, GCF NetworkUtilities.
Simple LUI Sample: Demonstrates the following functionality: MEEP v.8 LUI, MEEP v.8 Key, DIO v.1.1 I2C, DIO v.1.1 GPIO
Socket Client Sample: Demonstrates how to establish a TCP connection with a server and send messages to it. The sample can connect to any TCP server. See
SocketServerSample for a sample server written for Java ME Embedded platform).
Socket Server Sample: Demonstrates how to listen for incoming TCP connections, accept and receive messages from the clients. The sample can work with any TCP client such as like nc or telnet. See
SocketClientSample for a sample client written for Java ME Embedded platform.
System Controller Sample: Displays the state of other applications, enables you to run and stop them using a simple command-line interface, and does other application management tasks. Demonstrates the following functionality: MEEP Software Management (SWM), CLDC Logging, CLDC Timers, GCF Server Sockets, DIO GPIO Pins, DIO Watchdog, MEEP Power, Application autostart.
System Info Sample: Reads system properties and information about the amount of memory used by the JVM, displays details about installed and running applications. Demonstrates part of MEEP SWM functionality.
Temperature Collector Sample: Measures temperature periodically and stores results. When a remote client connects, it sends the average temperature to the client. Demonstrates the following functionality: MEEP PushRegistry Alarm, MEEP PushRegistry Push Notifications, MEEP Record Store Management (RMS), GCF Server Socket, CLDC system time.
Wireless Messaging Sample: Demonstrates features of JSR 120 - Wireless Messaging API.
XML API Sample: Demonstrates the general features of JSR 280 - XML API.
You can run the default sample applications from NetBeans IDE or Eclipse IDE by creating the corresponding project. Then you run the project to try out the features that the demo was created for.
Before using the Oracle Java ME SDK sample applications, carefully read Installation and Runtime Security Guidelines. Some demonstrations use network access and open ports, and do not include protection against malicious intrusion. If you run the sample projects, ensure that your environment is secure.
To create a Java ME sample application project in NetBeans IDE:
Open the File menu and select New Project.
In the Categories list, expand Samples and select Java ME SDK 8.3.
Select the sample application from the Projects list and click Next.
Enter a name for the project or leave the default, change other settings as necessary, and click Finish.
To create a Java ME sample application project in Eclipse IDE:
If you are behind a firewall, you can configure the sample applications to use proxy server settings that you define.
The sample application proxy server settings typically match the proxy server settings used in your web browser. To manually set the proxy server settings for your sample applications, do the following:
Sometimes a sample application does not run successfully. Often, the problem is your environment.
Some demonstrations require specific setup and instructions. For example, see Configuring the Web Browser and Proxy Settings
Because sample programs can be started remotely, virus checking software can sometimes prevent them from running. In the console, you see warnings that the emulator cannot connect.
Consider configuring your antivirus software to allow access to sample application directories and components.