Java ME (Java Platform, Micro Edition) Programming

Java ME (Java Platform, Micro Edition) Programming

Wen-Chen Hu (University of North Dakota, USA)
DOI: 10.4018/978-1-59140-769-0.ch011
OnDemand PDF Download:
$37.50

Abstract

Most client-side handheld programming uses either Java or C/C++. This chapter introduces Java ME (previously known as J2ME), which is a version of Java (Sun Microsystem Inc., 2004). Java ME is a collection of technologies and specifications used to develop a platform that fits the requirements of mobile devices such as consumer products, embedded devices, and advanced mobile devices. It creates a complete Java runtime environment tailored to fit the specific requirements of a particular device or market. Java ME includes user interfaces, security, built-in network protocols, and support for networked and offline applications that can be downloaded dynamically. Compared to other client-side handheld programming languages, Java ME is light-weight and easy to learn, although this also means that Java ME may not contain as many features as other languages. Advanced Java ME programming will be discussed in the next chapter. Chapters 13 and 14 will discuss Palm OS programming, which uses C/C++.
Chapter Preview
Top

Java Me Programming Steps

Figure 1 shows the Sun Java Wireless Toolkit© used to develop wireless applications that are based on Java ME’s CLDC and MIDP. The toolkit includes the emulation environments, performance optimization and tuning features, documentation, and examples that developers need to bring efficient and successful wireless applications to market quickly. The following steps show how to develop an MIDP application, in this case a simple “Hello, World!” program, under Microsoft Windows XP:

Figure 1.

A screenshot of KToolbar after launching © 2008 Sun Microsystems, Inc.

  • 1.

    Download and install Sun Java Wireless Toolkit 2.3 Beta, which includes a set of tools and utilities and an emulator for creating Java applications that run on handheld devices, at the URL (http://java.sun.com/products/sjwtoolkit/download-2_3.html).

  • 2.

    Run the development environment KToolbar of an MIDlet, an MIDP application, as shown in Figure 1 by selecting the following Windows options:

Start ⇒ All Programs ⇒ Sun Java Wireless Toolkit 2.3 Beta

⇒ KToolbar

  • 3.

    Create a new project by giving a project name such as HelloSuite and a class name such as HelloMIDlet as shown in Figure 2. After the project HelloSuite is created, the KToolbar will display the message shown in Figure 3, which specifies where the Java source files, application resource files, and application library files are to be put.

    Figure 2.

    A screenshot of the pop-up window obtained after clicking on the button “New Project” of KToolbar © 2008 Sun Microsystems, Inc.

    Figure 3.

    A screenshot of KToolbar after the project HelloSuite is created © 2008 Sun Microsystems, Inc.

  • 4.

    Create a J2ME source program and place it in the directory of the local disk (C:\WTK23\apps\HelloSuite\src\). Figure 4 gives a J2ME example, which displays the text “Hello, World!” and a ticker with the message “Greeting, world.”

    Figure 4.

    An example of a MIDlet program HelloMIDlet.java

  • 5.

    Build the project by clicking on the “Build” button. The “Build” includes compilation and pre-verifying.

  • 6.

    Run the project by clicking on the “Run” button. An emulator will be popped up that displays the execution results of the built project. For example, Figure 5 shows an emulator displays the execution results of HelloSuite.

    Figure 5.

    The screenshot of an emulator displaying the execution results of HelloSuite © 2008 Sun Microsystems, Inc.

  • 7.

    Upload the application to the handheld device using USB cables, infrared ports, or Bluetooth wireless technology.

Complete Chapter List

Search this Book:
Reset
Table of Contents
Preface
Wen-Chen Hu
Chapter 1
Wen-Chen Hu
With the introduction of the World Wide Web, electronic commerce revolutionized traditional commerce, boosting sales and facilitating exchanges of... Sample PDF
Fundamentals of Mobile Commerce Systems
$37.50
Chapter 2
Wen-Chen Hu
Commerce, the exchange or buying and selling of commodities on a large scale involving transportation of goods from place to place, benefits from... Sample PDF
Mobile Commerce Applications
$37.50
Chapter 3
Wen-Chen Hu
Mobile users interact with mobile commerce applications by using small wireless Internet-enabled devices, which come with several aliases such as... Sample PDF
Mobile Handheld Devices
$37.50
Chapter 4
Wen-Chen Hu
Without ways to conduct secure commercial information exchange and safe electronic financial transactions over mobile networks, neither service... Sample PDF
Essential Mobile-Commerce Technology
$37.50
Chapter 5
Wen-Chen Hu
As handheld computing is a fairly new computing area, there is as yet no generally accepted formal definition. For the purposes of this book... Sample PDF
Mobile World Wide Web Content
$37.50
Chapter 6
Wen-Chen Hu
Wireless application protocol (WAP) (Open Mobile Alliance, 2003) is a suite of network protocols that specifies ways of sending data across the... Sample PDF
WML (Wireless Markup Language)
$37.50
Chapter 7
Advanced WML  (pages 180-206)
Wen-Chen Hu
Chapter VI discusses the creation of static web pages, which have a fixed content at all times. In order to change static web pages to dynamic ones... Sample PDF
Advanced WML
$37.50
Chapter 8
WMLScript  (pages 207-228)
Wen-Chen Hu
WML is a markup language used for text formatting and displaying (Open Mobile Alliance, 2001). However, the functions of a markup language are... Sample PDF
WMLScript
$37.50
Chapter 9
Wen-Chen Hu
Numerous server-side handheld applications are available for devices. Some popular applications include: • Instant messages, which require service... Sample PDF
Database-Driven Mobile Web Content Construction
$37.50
Chapter 10
Wen-Chen Hu
There are two kinds of handheld computing and programming, namely client- and server- side handheld computing and programming. The most popular... Sample PDF
Client-Side Handheld Computing and Programming
$37.50
Chapter 11
Wen-Chen Hu
Most client-side handheld programming uses either Java or C/C++. This chapter introduces Java ME (previously known as J2ME), which is a version of... Sample PDF
Java ME (Java Platform, Micro Edition) Programming
$37.50
Chapter 12
Wen-Chen Hu
Chapter XI introduced the basics of Java ME programming. This chapter will build on this, focusing on advanced Java ME programming. The following... Sample PDF
Advanced Java ME Programming
$37.50
Chapter 13
Palm OS Programming  (pages 333-350)
Wen-Chen Hu
Programming for Palm devices is not a trivial task and it is especially hard for beginners starting their first assignment. This chapter is not... Sample PDF
Palm OS Programming
$37.50
Chapter 14
Wen-Chen Hu
The introduction to Palm OS programming given in the previous chapter provided an overview of its structure and basic concepts. This chapter... Sample PDF
Advanced Palm OS Programming
$37.50
The Resource Description Files: ResourceDescription1.xrd
About the Author