Home > Articles > Programming > Java

Java On Pocket PC Devices

  • Print
  • + Share This
Have you ever wondered how to create Java applications for Pocket PC devices? These gadgets have become come more and more popular with businesspeople, students, and other folks who appreciate the connections to Microsoft Office applications. Read Mikko Kontio's tips on how to get started and where to find more information.
Like this article? We recommend

Pocket PC devices have become more and more popular during the last few years. Businesspeople, students, and others have learned the value of portable devices—and especially their connections to Microsoft Office applications. Their biggest competitors are Palm OS devices, smart phones, and the lightest laptops.

Java has become quite popular, especially among mobile phone users. Its wide variety of applications, mostly games, is available and easy to buy. Palm OS and Pocket PC devices don't have the same kind of built-in easy installation techniques that mobile phones with MIDP (Mobile Information Development Profile) have. So buying and installing Java software for Palm OS or Pocket PC devices can be quite challenging for the less-than-tech-savvy folks among us.

There are three ways to develop software for Pocket PCs with Java: by using MIDP, Personal Java, and third-party technologies. This article examines what the development consists of with these technologies and also takes a look at possible runtime environments, virtual machines, which are on the market.

MIDP Applications on the Pocket PC

MIDP is a Java API for mobile information devices (mostly mobile phones). MIDP is wildly popular; in fact, most of today's phone models have MIDP 1.0 or 2.0.

It is possible to run MIDP applications (or MIDlets, as they are called) in Pocket PC devices. To run them, you need to install a virtual machine for MIDP first; then you can run your MIDlets with the JVM. IBM's WebSphere Studio Device Developer is an integrated development environment that has all the necessary tools for deploying J2ME software for multiple platforms. There is a file (in English: midpng.ppc.cab) that allows you to run MIDlets. First, you need to install the cab file and then install the MIDlets. There's a free evaluation version, so give it a try.

Listing 1 shows what the body of an MIDP application looks like. The HelloMIDlet class is the main class of the application; the startApp(), pauseApp(), and destroyApp() methods need to be implemented for the VM. The commandAction() method is implemented because the MIDlet implements the CommandListener interface, which allows it to react to user inputs.

Listing 1 The Body of a MIDlet.

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloMidlet extends MIDlet implements CommandListener{
  public void startApp(){
   // When the application is started,this method gets called

  public void pauseApp(){
   // When the application is paused,this method gets called

  public void destroyApp(boolean unconditional){
   // When the application is killed,this method gets called

  public void commandAction(Command command, Displayable screen){
   // If the command is the doneCommand
  • + Share This
  • 🔖 Save To Your Account