Sun Java Solaris Communities My SDN Account Join SDN
 
Article

The J2ME Wireless Toolkit 2.1

 


The J2ME Wireless Toolkit is a comprehensive set of tools for building MIDP applications. Version 2.1 includes several significant new features, which are described in this article.

The toolkit can be used standalone, or incorporated into many popular integrated development environments (IDEs). Version 5 of Sun One Studio, Mobile Edition comes with the J2ME Wireless Toolkit 2.1 bundled in.

A Brief History

Version 1.0 of the J2ME Wireless Toolkit provided a complete MIDlet build cycle at the touch of a button. Version 1.0.4 added significant features, like support for obfuscation in the build cycle, a method profiler, a memory monitor, and a network monitor. Version 2.0 was a big step forward, providing support for MIDP 2.0, the Wireless Messaging API (WMA), and the Mobile Media API (MMAPI).

Version 2.1 of the J2ME Wireless Toolkit implements several important enhancements, including support for JSR 185, Java Technology for the Wireless Industry (JTWI), and for JSR 172, J2ME Web Services.

Flower Power

New DefaultColorPhone
New DefaultColorPhone
(Click for the full image.)

Before diving into the technical details, take a moment to enjoy the new skin on the toolkit's DefaultColorPhone. Although the phone's appearance is more stylish, the screen remains 180x208 pixels, capable of displaying 256 colors. (A regular canvas doesn't use the full screen and ends up being 177x180 pixels.)

An Application Environment for the Wireless Industry

Version 2.1 of the J2ME Wireless Toolkit supports the Java Technology for the Wireless Industry specification. (See Understanding JSR 185 for more information.) JTWI specifies a complete MIDP-based stack, including CLDC 1.0 or 1.1, MIDP 2.0, WMA, and optionally, MMAPI. JSR 185 is more than just a conglomeration of other specifications; it includes clarifications to its component specifications that nail down a clear and predictable programming environment for developers.

Choosing APIs

The toolkit doesn't move forward to JSR 185 without looking back also. Projects can be configured for MIDP 1.0 or MIDP 2.0, with any combination of optional packages. The toolkit takes care of the details, which is very handy for building projects for specific stacks. My Nokia 3650, for example, has the following stack:

  +----------+----------+----------+
  | MIDP 1.0 |    WMA   |   MMAPI  |
  +----------+----------+----------+
  | CLDC 1.0 |
  +----------+

Version 2.1 of the toolkit makes it easy to tailor a project's build environment to specific APIs. To see how this works, open up a project using the toolkit's KToolbar. Click on Settings to open the project settings dialog. The first tab you'll see is API Selection, as here:

API Selection
API Selection

It's pretty easy to select any kind of API stack you need. The toolkit sets the attributes in the MIDlet descriptor appropriately, and it changes which APIs are available during the build. This very handy feature makes it easy to ensure you're using only a specific set of APIs. To build applications for my Nokia 3650, for example, I select these settings:

Choosing APIs for the Nokai 3650
Choosing APIs for the Nokia 3650

You may remember that version 2.0 of the toolkit had a similar API selection screen that was part of the overall KToolbar preferences. In version 2.1 the API settings are specific to each project, which makes it easy to switch between projects that are designed for different stacks.

Everybody's Got to Have Web Services

Web services is the latest hot trend in distributed computing. Essentially it allows devices to run code remotely using XML messages. A shiny new specification, JSR 172, describes an optional package that makes it easy for MIDlets to use web services.

As you may have already guessed from the API Selection part of the project settings, the J2ME Wireless Toolkit 2.1 supports JSR 172. There is even an example, JSR172Demo, that shows you how to communicate with a simple web service.

The toolkit includes a stub generator that creates a stub class based on a Web Services Description Language (WSDL) file. The simplest way to use this feature is to choose Project -> Stub Generator from the KToolbar menu. You just need to supply a WSDL file and tell the utility which package will contain the stub. (Alternately, you can access the utility by choosing File -> Utilities and click on the Stub Generator button.)

A More Selective Profiler

The toolkit's profiler has one very important new feature. You can now tell it to exclude information about system classes from the profiling report. When you're not bombarded with information about the underlying MIDP implmentation, it's much easier to focus on what the profiler tells you about your own code. To suppress or request information about system classes, choose Edit -> Preferences, and the Monitor tab:

Enabling the Method Profiler
Enabling the Method Profiler
(Click for the full image.)

If you leave Show System Classes unchecked, the profiler only shows you call graphs (in the left pane of the profiler window) that contain methods you've written.

Summary

The J2ME Wireless Toolkit 2.1 includes several important new features. Chief among these is support for JSR 185 and JSR 172. A new project-based API selector makes it easy to build projects for specific software stacks. Finally, the method profiler can now highlight your application classes, making it easier to spot performance bottlenecks. The J2ME Wireless Toolkit is better than ever; go download version 2.1 and give it a try.




Reader Feedback
Excellent   Good   Fair   Poor  

If you have other comments or ideas for future technical tips, please type them here:

Comments:
If you would like a reply to your comment, please submit your email address:
Note: We may not respond to all submitted comments.

Have a question about Java programming? Use Java Online Support.



Back To Top