Java Reference
In-Depth Information
Bandwidth is expensive in terms of both time and money. Today's wireless networks are
relatively slow, so less data passing through the air means less waiting time for your
users. Also, wireless service tends to be pricey, so less data passing through the air means
smaller bills for your users.
Small devices have limited memory and processing power. It is unwise to spend these
limited resources on tasks like parsing HTML. In general, you will be able to place most
of the processing burden of your application on a server component, making your client
MIDlet's life very easy.
In this particular application, the HTML parsing is not very stable. Suppose the server we
are using decides to return its Jargon File definitions in a different format; if four million
users are running Jargoneer , then four million copies of our code have just broken.
Performing this task on a server gives it a single point of failure and a single point of
update. If we fix the parsing code on the server, the interface between the server and the
client devices can remain unchanged. This makes it easy to upgrade or fix Jargoneer .
Network MIDP applications are likely to need a server component. If you're planning to do
much MIDP development, you might like to study up on Java servlets.
Packaging Your Application
You won't pass class files directly to a MIDP to deploy an application. Instead, you'll package
them in a Java Archive (JAR) using a packager such as the jar tool that comes with the Java 2 SDK.
If you're using the J2ME Wireless Toolkit, you won't ever have to perform these steps
manually; the toolkit automatically packages your MIDlets when you choose Project Package
Create Package from the menu. (You don't have to do this if you just want to test your appli-
cation in the emulator, but you need to create a package if you're going to distribute the MIDlet
suite.) Even if you use the J2ME Wireless Toolkit, you might want to read through this section
so that you understand exactly what's going on.
If you're using the MIDP reference implementation, you should follow these steps to
package your MIDlets. We'll only sketch the steps here; in the next chapter, you'll learn all the
gory details of MIDlets and MIDlet suites.
Manifest Information
Every JAR includes a manifest file, META-INF\MANIFEST.MF , that describes the contents of the
archive. For MIDlet JARs, the manifest file must contain extra information. The extra informa-
tion is stuff that's important to the MIDP runtime environment, like the MIDlet's class name
and the versions of CLDC and MIDP that the MIDlet expects.
You can specify extra manifest information in a simple text file and tell the jar utility to
include that information in the manifest when the JAR is created. To package Jargoneer , for
example, save the following text in a file named extra.mf :
Search WWH ::




Custom Search