|C H A P T E R 1|
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.
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.
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:
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.
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
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
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.
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.
The Sun JavaTM Wireless Toolkit for CLDC supports the creation of MIDP applications with the following main features:
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:
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.
The Sun JavaTM Wireless Toolkit for CLDC supports many standard Application Programming Interfaces (APIs) defined through the Java Community Process (JCP) program. TABLE 1-1 shows the APIs and includes links to the specifications.