ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

The Mobile Information Device Profile and MIDlets, Part 5
Pages: 1, 2

If you experience problems with this example, check that the server is properly configured and that the JAR and JAD files are consistent:

  • The URL that you supply to the AMS must point to an HTML file that contains absolute hypertext links to one or more JAD files. The HTML file for this example looks like this:
            J2ME in a Nutshell Example MIDlet Download Page
            Install the example MIDlet suite for
            <A HREF="http://localhost:8080/Chapter3.jad">Chapter 3</A> 
    		of "J2ME in a Nutshell".
  • The web server must be configured to return JAD files with MIME type text/vnd.sun.j2me.app-descriptor.
  • The MIDlet-Jar-URL attribute in the JAD file must be an absolute URL pointing to the JAR file.
  • The JAD file must contain the mandatory attributes listed in Table 3-2.

If the AMS locates any JAD files, it displays a list of the links that point to them, using the text within the <A></A> tag pair to identify each MIDlet suite, as shown on the right side of Figure 3-12. This implementation does not display the MIDlet suite name or the JAR file size from the JAD file because it hasn't fetched it yet. To continue with the installation process, press the Install button.

At this point, the Wireless Toolkit AMS reads the JAD file from the server and uses the MIDlet-Jar-URL attribute to locate and fetch the JAR file. If this process succeeds, a confirmation message appears as shown on the left side of Figure 3-13. After a short pause, the application manager switches back to its main screen, shown in the center of Figure 3-13. If you compare this to Figure 3-11, you'll see that the main screen now contains the name of the MIDlet suite that was just installed. The list of installed MIDlets is saved on the device, so this list will reappear when you next run the emulator. In the case of a MIDlet suite containing more than one MIDlet, the list in the main screen displays each suite together with the MIDlets that it contains. An example of this is shown on the right-hand side of Figure 3-13, in which a MIDlet suite called Chapter5 containing individual MIDlets called Socket, Time, Ranking and others that are not visible in the screen shot, has been installed.

Figure 3-13. Installing a MIDlet suite

The main screen also includes an option that lets you launch MIDlets. If you select a MIDlet suite and choose this option, the usual MIDlet selector lets you pick the actual MIDlet to be run (see Figure 3-8). For a suite with multiple MIDlets, you can also choose an individual MIDlet from the main screen and launch it directly.

The Menu option provides access to the other application management features of the Wireless Toolkit AMS, presented in the form of a list, as shown in Figure 3-14.

Figure 3-14. The Wireless Toolkit AMS application management menu


Of these menu items, only the first three are worth discussing here. Each of these items operates on a MIDlet suite, so selecting any of them brings up another copy of the MIDlet selection screen so that you can choose the suite to which the command should apply.

The Info command displays the content of the JAD file that was fetched when the MIDlet suite was installed. Ideally, this information would be displayed to the user before the installation process starts, but, as noted previously, the Wireless Toolkit AMS does not implement this feature. Figure 3-15 shows the information displayed for the Chapter3 MIDlet suite.

Figure 3-15. MIDlet suite information as displayed by the Windows Tooklit AMS


The Update command reinstalls the MIDlet suite from its original source. As noted earlier, the AMS can compare the MIDlet version in its installed JAD file and the one it acquires from the server to determine if it already has the latest version of a MIDlet suite.

The Remove option deletes a MIDlet suite and all its associated persistent storage from the device. The Wireless Toolkit AMS displays a warning message and asks the user for confirmation before performing this operation (see Figure 3-16).

Figure 3-16. Deleting a MIDlet suite using the Wireless Toolkit AMS


The Wireless Toolkit AMS can be controlled from the command line as well as through its user interface. For example, you can install a MIDlet suite directly from a web server using the command:

c:\j2mewtk\bin\emulator.exe -Xjam:install=http://www.yourserver.com/

A complete description of the command-line arguments recognized by the Wireless Toolkit emulator can be found in Chapter 8.

1. The term Java Application Manager (or JAM) was originally used to describe the MIDP application management software. However, this resulted in confusion with the Java Application Manager software that is part of the CLDC reference implementation, which performs similar functions but with which it is incompatible.

Kim Topley has more than 25 years experience as a software developer and was one of the first people in the world to obtain the Sun Certified Java Developer qualification.

J2ME in a Nutshell

Related Reading

J2ME in a Nutshell
By Kim Topley

Return to ONJava.com.