C H A P T E R  1

Introduction

This book describes how to use the Sun JavaTM Wireless Toolkit for CLDC.

The Sun JavaTM Wireless Toolkit for CLDC is a set of tools that makes it possible to create applications for mobile phones and other wireless devices. Although it is based on the Mobile Information Device Profile (MIDP) 2.1, the Sun JavaTM Wireless Toolkit for CLDC also supports many optional packages, making it a widely capable development toolkit.


1.1 About the Multiple User Environment

The Sun Java Wireless Toolkit 2.5.2 for CLDC can be installed on a system running a supported version of either Windows or Linux. All users with an account on the host machine can access the toolkit, either singly or simultaneously.

1.1.1 The Installation Directory and the Working Directory

Windows paths include a drive letter and use backslashes as directory separators. Linux paths use forward slashes. In Linux paths, ~ represents a Linux user's home directory.

To support multiple users the toolkit creates an installation directory that is used as a source for copying. This document uses the variable workdir to represent the toolkit working directory and toolkit to represent the installation directory. Each user's personal files are maintained in a separate working directory named j2mewtk that has a subdirectory for each version installed. The default location of workdir is typically in one of these locations:


Windows:

C:\Documents and Settings\User\j2mewtk\2.5.2
(where User is your account name)

Linux:

~/j2mewtk/2.5.2 (where ~ is your home directory)


Prominent differences between Windows and Linux are described in the documentation. If only one operating system is mentioned, you can assume the above path notation differences apply.

1.1.2 Working Directory Files

At installation time the installer copies a subset of files from the installation directory to the working directory of each user. The working directory contents are as follows:

All the source code for the demonstration applications is available in toolkit\apps, and each demonstration has its own project directory. Any applications placed in toolkit\apps are visible to all users.

For example, on Windows the source code for the MobileMediaAPI demonstration is in toolkit\apps\MobileMediaAPI\src. When you use the Open Project command, you can see projects in the installation directory and your working directory (if they exist). As shown in FIGURE 1-1, projects in your local directory are shown in bold font, and projects in the installation directory are shown in italic font. To see only your local files, clear the Show available demos check box.

FIGURE 1-1 Project Listing Shows Local Projects in Bold Face


Open Project Dialog with apps from installdir and workdir displayed

When you open a project from the installation directory, a copy of the application is imported into workdir\apps. Often the import process is undetectable, but on slower machines you might see a progress dialog like that in FIGURE 1-2. Any customizations should be made to your local copy.

FIGURE 1-2 Project Import from toolkit to workdir



1.2 Quick Start

To get started right away, try the demonstration applications that are included with the Sun JavaTM Wireless Toolkit for CLDC.

To run the demonstrations, start the toolkit as follows.

A window similar to FIGURE 1-3 opens.

FIGURE 1-3 Toolkit User Interface


Click the Open Project button to see a list of all the available applications. As shown in FIGURE 1-1, italicized names denote applications stored in the installation directory, and bold names, if any, are stored in your working directory. Pick one of them and click the Open Project button in the dialog. If you have not opened this project before, a copy will be created in your working directory, as discussed in Section 1.1.2, Working Directory Files.

Once the application is open, press the Run button. The emulator appears running the example application.

Most demonstrations are self explanatory, but some have additional instructions. Some demos require you to use Project > Run via OTA instead of run. See Appendix A for general instructions and descriptions of demos.


1.3 Toolkit Components

The Sun JavaTM Wireless Toolkit for CLDC has three main components:

From the user interface you can build applications, launch the emulator, and start the utilities. Alternatively, the emulator and utilities can be run by themselves, which is useful in many situations. If you want to demonstrate MIDP applications, for example, it's useful to run the emulator by itself.

The only additional tool you need is a text editor for editing source code.


1.4 Toolkit Features

The Sun JavaTM Wireless Toolkit for CLDC supports the creation of MIDP applications with the following main features:


1.5 Toolkit Updates

At installation you are given the option to activate the Check for Product Updates feature. This feature uses the network to check for an update every seven days. To determine whether an update is needed, it collects the following information:

This data is used to improve the product. Please read Sun's privacy policy at http://www.sun.com/privacy/index.html.

To activate or deactivate this feature, select Edit > Preferences and click Network Configuration. Towards the bottom of the panel, check or uncheck the Check for updates box.


1.6 Supported Technology

The Sun JavaTM Wireless Toolkit for CLDC supports many standard Application Programming Interfaces (APIs) defined through the Java Community Processtrademark (JCPtrademark) program. TABLE 1-1 shows the APIs and includes links to the specifications.


TABLE 1-1 Supported JCP Program APIs

JSR

API

Name

URL

JSR 248

MSA 1.0

Mobile Service Architecture

http://jcp.org/en/jsr/detail?id=248

JSR 185

JTWI 1.0

Java Technology for the Wireless Industry

http://jcp.org/en/jsr/detail?id=185

JSR 139

CLDC 1.1

Connected Limited Device Configuration

http://jcp.org/en/jsr/detail?id=139

JSR 118

MIDP 2.0

Mobile Information Device Profile

http://jcp.org/en/jsr/detail?id=118

JSR 75

PIM and File

PDA Optional Packages for the J2ME Platform

http://jcp.org/en/jsr/detail?id=75

JSR 82

Bluetooth and OBEX

Java APIs for Bluetooth

http://jcp.org/en/jsr/detail?id=82

JSR 135

MMAPI 1.1

Mobile Media API

http://jcp.org/en/jsr/detail?id=135

JSR 172

J2ME Web Services Specification

http://jcp.org/en/jsr/detail?id=172

JSR 177

SATSA

Security and Trust Services API for Java ME

http://jcp.org/en/jsr/detail?id=177

JSR 179

Location

Location API for Java ME

http://jcp.org/en/jsr/detail?id=179

JSR 180

SIP

SIP API for Java ME

http://jcp.org/en/jsr/detail?id=180

JSR 184

3D Graphics

Mobile 3D Graphics API for J2ME

http://jcp.org/en/jsr/detail?id=184

JSR 205

WMA 2.0

Wireless Messaging API

http://jcp.org/en/jsr/detail?id=205

JSR 211

CHAPI

Content Handler API

http://jcp.org/en/jsr/detail?id=211

JSR 226

Scalable 2D Vector Graphics API for J2ME

http://jcp.org/en/jsr/detail?id=226

JSR 229

Payment API

http://jcp.org/en/jsr/detail?id=229

JSR 234

AMMS

Advanced Multimedia Supplements

http://jcp.org/en/jsr/detail?id=234

JSR 238

MIA

Mobile Internationalization API

http://jcp.org/en/jsr/detail?id=238

JSR 239

Java Binding for OpenGL® ES API

http://jcp.org/en/jsr/detail?id=239

JSR 248

Mobile Service Architecture

http://jcp.org/en/jsr/detail?id=248


 


1 (Footnote) Depending on how Microsoft Windows is configured, you might need to choose Start > All Programs instead of Start > Programs.