The MIDP Application Development Process
 
The MIDP Application Development Process • Designing and Coding • Compilation • Preverification • Packaging • Deployment and Execution • Using the J2ME Wireless Toolkit As you already know, J2ME applications are Java programs and execute under the control of a Java VM. For this reason, all J2ME devices must support a Java runtime environment. MIDP applications, like any other application, go through a development cycle. This chapter discusses the development cycle and process for MIDP applications. Disconnected devices like mobile phones typically don't have development environments built into them. Without a development environment on the device itself, developers must do crossplatform development—develop an application on another system, download it to the device, and then test it there. Having to constantly download the application-in-progress to the device in order to test it makes the processes of development and testing challenging and tedious. Emulators provide an alternative. They simulate the device execution environment and allow you to perform the full development cycle on another system. Emulators provide an environment that supports editing, compilation, execution, and debugging. Such an environment is advantageous because it lets you avoid the repetitive download-and-installation cycle to the device. It also lets you avoid the problem of buggy programs crashing your mobile device. Various mobile device manufacturers and third parties offer emulators that run on standard desktop operating systems. The Java Software division of Sun Microsystems, for example, offers a reference J2ME Wireless Toolkit (J2MEWTK), which runs on Windows and Unix platforms. It contains an emulator, compiler, VM, class libraries, and other useful development tools. You can download it free of charge from http://java.sun.com. The development process for J2ME applications is largely similar to that of regular Java program development, with a few differences. The application development process consists of the following steps: 1. Design and code— Write the program. 2. Compile— Compile the program with a standard J2SE Java compiler. 3. Preverify— Perform preverification processing on the Java classes prior to packaging: check for the use of floating point operations and finalize methods in the Java classes. 4. Package— Create a JAR file containing the application resources; create an application descriptor file containing application metainformation. 5. Deploy— Place the application resources under the control of the emulator. 6. Execute— Run the application using the emulator. 7. Debug— Identify and isolate program bugs and make corrections to source code. The preverification and packaging stages are new and unique to the J2ME application process and will be explained shortly. You can perform all of the foregoing steps by hand using a command shell and command-line versions of the development tools. In this chapter, I'll first show you each step using only the 14 command-line tools so you can understand how the process works conceptually. Thereafter, I'll use the Java Software reference J2ME Wireless Toolkit emulator. Incidentally, the command-line examples shown in this book use the Unix shell syntax supported by the GNU project's bash shell. With a few syntax changes, the examples are still relevant for a Microsoft Windows MS-DOS prompt shell. I don't discuss the source code here, because the focus of this chapter is to see how to take a perfectly valid CLDC/MIDP application through the whole application development cycle. In chapter 3, I'll start to analyze code to show you the toolkit abstractions and programming model and to explain the essential parts of the application. The GNU project has produced literally hundreds of Unix style utilities and applications. They have been ported to run on a variety of OS platforms, including Windows. These tools include everything from Unix utilities, shells, compilers, linkers, and source code control tools, to applications such as PostScript viewers, the Emacs text editor, and sophisticated image processing applications, just to name a few. The GNU resources are maintained under the auspices of the Free Software Foundation (FSF). You can find information about the GNU project and the Free Software Foundation at the Free Software Foundation Web site, http://www.fsf.org.
175 times read
|