Motorola released MOTODEV Studio for Java™ ME in September 2007. MOTODEV Studio is a development environment that includes a range of tools and utilities for developing and testing applications for a wide range of Motorola products and can be downloaded freely from the MOTODEV site. This article provides instructions for developers to use the MWay Tool included with MOTODEV Studio for transferring and debugging Java MIDlets on Motorola operating system (OS) handsets.
Motorola regularly publishes free Software Development Kits (SDKs) on the MOTODEV portal site that include all the tools and documentation necessary to develop, test and deploy Java™ ME applications to Motorola handsets. Included in the these standalone SDKs is a tool called MIDway which is the recommended way for developers to transfer MIDlets to their Motorola OS handsets for testing and debugging. MWay, included in MOTODEV Studio, provides the same functions and is the new preferred method of transferring MIDlets to Motorola OS handsets for testing and debugging.
Developers who are unfamiliar with MOTODEV Studio or its use are encouraged to view our 'MOTODEV Studio for Java ME v1.0' article for further information. This article assumes the reader has already installed MOTODEV Studio and is familiar with Java MIDlet development and is ready to begin transferring their MIDlets to a Motorola OS handset for testing and debugging. To verify the operating system of your handset, go to the MOTODEV site where OS and other handset-specific information can be found.
Before you can use MWay to load Java MIDlets to your Motorola OS handset, you must enable the 'Java App Loader' menu item on your handset. This can be done using the Config Tool in MOTODEV Studio.
The following procedure details the steps necessary to enable the 'Java App Loader' menu item on the Motorola V3x handset.
To enable the Java App Loader:
- Connect the handset to a PC via a mini USB cable
- Within MOTODEV Studio, open the "JavaME Options" view
- Select the "Tools" tab
- Select the CONFIG TOOL button to display the Config Tool view
- Select the Refresh button
on the Config Tool view to display handset information - The Config Tool retrieves information from your handset such as your handset Universal Identifier (UID) and its International Mobile Equipment Identity or IMEI. Select the
button that is adjacent to the "JAL" entry to enable the 'Java App Loader' menu on the device.
- Once the 'Java App Loader' menu is enabled, the Disabled button becomes active and the Enabled button becomes inactive. Restart the handset to verify the availability of a new 'Java App Loader' menu item under Settings → Java Settings menu.
The first step in using MWay is to connect your Motorola OS handset with your PC using a mini USB cable. How your PC recognizes your handset depends on the handset's connection type setting found in Connection → USB Connection menu. Setting your connection type to 'Data Connection' enables MWay to transmit Java MIDlets to your handset.
You are now ready to launch MWay by selecting the MWay button located within the Java ME Options view. To display this view, select Show View -> Java ME Options from the Window Menu as shown below.
This displays the Java ME Options view in its default upper right hand corner location within MOTODEV Studio.
Selecting the MWay button from the Tools tab launches the MWay Tool, which automatically connects to your Motorola OS handset.
NOTE: See the Troubleshooting section, later in this article, for dealing with common connection problems that may occur at this point.
MWay launches as a console program, as shown in Figure 5, and waits for instructions.
The MWay command supports a number of options to help in debugging and transferring MIDlets. In this article we will look at the most common options used with the MWay command. Appendix A summarizes all the options and their use in a table format.
Transferring a MIDlet to the handset
Sending a MIDlet to your handset via MWay requires specifying the location of your Java MIDlet's JAD file on your development PC. For instance, to load a Java MIDlet, created in MOTODEV Studio from this directory, on your development PC – 'C:\Dev\VideoMIDlet\deployed' you simply specify this location and JAD file name after the MWay command prompt.
>MWAY C:\Dev\VideoMIDlet\deployed\VideoMIDlet.jad
MWay transfers the JAR file specified by the JAD file's mandatory MIDlet-Jar-URL attribute.
Specifying Port
When you connect your handset to your development PC, your PC will connect to the handset on a specific port. On Windows XP you can verify the port number from the Device Manager. Device Manager, in turn, can be started from the System Properties window located in [Start] → [Control Panel] → [System menu]. Launch the Device Manager from the [Device Manager] button on the System Properties window Hardware Tab, as shown in Figure 6.
When connected to your PC, your Motorola OS handset will be recognized and displayed in Device Manager as a Modem. Select the '+' symbol to the left of 'Modems' to display the modem for your handset. Right-click on your handset modem entry and select Properties from the pop-up menu as shown in Figure 7.
The Modem tab displays the Port being used to communicate with your handset modem. In the screen shot in Figure 7, you can see that COM8 is being used to communicate to the handset.
The '/p' option can be supplied after the MWay command to specify the communication Port MWay should use. For instance this command specifies that MWay downloads the specified Java MIDlet to the hardware device connected on Port 14.
>MWAY /p 14 C:\Dev\VideoMIDlet\deployed\VideoMIDlet.jad
This initiates the transfer of the specified MIDlet to your handset. Users can then proceed to follow the on-screen directions on their handset to install the Java MIDlet.
By default, MWay displays KVM debug information during MIDlet installation and both KVM debug information and calls to System.out.print() method during MIDlet execution. To aid in debug analysis, the MWay '/l' option allows users to capture this debug information to a specified file. The following options will transfer the specified java MIDlet to the device on Port 14 and capture any KVM and System.out.print() method statement calls to a file called log1.txt located in the same directory as the Java MIDlet JAD and JAR files.
>MWAY /p 14 /l C:\Dev\VideoMIDlet\deployed\loggy1.txt
C:\Dev \VideoMIDlet\deployed\VideoMIDlet.jad
By default all KVM debug statements and any System.out.print() method calls included by the developer in the MIDlet are displayed to the console window running the MWay tool. This same debug information can also be captured and saved in the specified log file as explained above. For developers who find this distracting, MWay conveniently allows developers to filter out the unnecessary and sometimes distracting KVM debug information and only display to the console, or capture to a log file, specific debugging information chosen by the developer. This is done using the /F option and by specifying the specific filter string that the developer is interested in viewing or capturing.
For instance, a developer may only wish to capture or view System.out;print() debug statements from their MIDlet during execution. The following filter string qualifying the /F option outputs only debug statements starting with "DEBUG APP" string.
>MWAY /F "DEBUG APP" C:\Dev \VideoMIDlet\deployed\VideoMIDlet.jad
Integrating MWay into Windows Explorer means that developers using a Windows Computer can send MIDlets to their ''Java App Loader' menu-enabled Motorola OS handsets by simply right-clicking on the MIDlet JAD file and selecting a shortcut in the pop-up Send To menu. We will now go through the steps to set this up on a development PC running Windows XP OS.
- Start Windows Explorer and navigate to 'Profiles\SendTo' directory. By default this is C:\Documents and Settings\<Windows login/user name>\SentTo
- Right-click inside the SendTo directory and select New → Shortcut as shown in Figure 9.
- Using the displayed Shortcut Wizard window, select the [Browse] button and navigate to your installation of <DEFAULT INSTALL DIRECTORY>\MOTODEV Studio for Java(TM) ME v1.0\JMESDK\tools\MWay and select the '
MWay-send-to.bat' file. Select the [Next] button on the Shortcut Wizard window. - Enter a name for this shortcut or leave the default 'MWay-send-to.bat' and select [Finish]. In this example we changed the name of the shortcut to 'MWAY'.
- Right-click the shortcut you created in MOTODEV Studio\MOTODEV Studio for Java ME v1.0\JMESDK\tools\MWay and select Properties. Change the Run value on the Shortcut Tab to 'Maximized' and select [OK] to close.
- Developers are now able to simply right-click on MIDlet JAD files and select the newly created shortcut from the 'Send To' menu. This shortcut feature still requires that you correctly connect your handset to your PC using a mini USB cable and that the 'Java App Loader' menu is enable and Java link is active.
You may be interested to know that the 'Shortcut Properties' window accepts MWay options inserted in the Target control. For example, rather than specifying a log file name to capture debug information every time the MWay command is run, you have the choice to enter the /L [log file name] in the Target window once and have this log file capture debug information every time MWay runs. You need to understand the contents of the log file will be overwritten each time the MWay command executes if you do not rename the specified log file after the MWay command is executed.
Following are some error message you may encounter while running MWay tool and steps you can take to resolve them.
The probable cause of this error is that the handset 'Java App Loader' was not enabled. When faced with this error, developers should ensure that the 'Java App Loader' menu is enabled, using steps discussed previously, and also that the handset was connected to the PC after selecting the 'Java App Loader' menu and launching the Java link between handset and PC.
Developers faced with this error message should confirm that MWay is connecting to the same COM port that their PC uses to connect to the handset. Developers should review the 'Specifying Port' section to see steps on how to verify what Port Windows XP uses to connect to handset. That port number is then used to quantify the MWay command '/p' option.
>MWAY /p 8 C:\Dev\VideoMIDlet\deployed\VideoMIDlet.jad
Unfortunately, not all Motorola OS handsets are supported by the Config Tool at this time. As time goes on, more handsets will be supported by the Config tool for developers who wish to retrieve handset information or enable the 'Java App Loader' menu. MOTODEV is currently keeping the 'Motorola UID Extraction Tool' on the MOTODEV site. This tool provides a feature to enable the 'Java App Loader' menu item on Motorola OS handsets. After installation of the UID Tool, the Start → Programs → Motorola UID Extraction Tool v2.x will include a User Guide with instructions on how to use the tool. Fortunately, the MWay tool is expected to work with all Motorola OS handsets, including those unsupported by the MOTODEV Studio Config Tool.
A table with MWay command options and the expected behavior is shown next. The options that qualify the MWay command are case insensitive, as is the MWay command itself.
| /Q | Quits MWay after the command completes. The default behavior is that MWay does not quit and remains connected to handset |
| /S | Silent mode. In this mode the KVM and System.out.print() method calls are not displayed to the console screen. |
| /P [port number] | This specifies the port number that the PC uses to communicate with the device. MWay needs to know this port number to find and transfer MIDlets to the device. |
| /L [logfile name] | This specifies the name of the logfile where KVM debug information is stored and the System.out.print() method calls will be captured. When only the name of the log file is supplied with the /L option, and not the full path, then the log file will be saved in the default installation directory. By default this directory isC:\Program Files\Motorola\MOTODEV Studio for Java(TM) ME v1.0\JMESDK\tools\MWay |
| /F [Filter string] | When developers are only interested in certain debug statements, they can filter out unnecessary debug statements using the /F option. Only statements beginning with the [Filter string] statement will be captured in log file if specified with /L option or the MWay console window. The /F option can only be qualified with one Filter string value. There is currently no support for multiple filters. |
Shortcut keys are also case insensitive. For example, both 'Q' and 'q' will quit the MWay Tool.
| Esc key, 'Q' | Quits MIDway. Consecutive MWay commands will automatically use the port previously used for communication. |
| Space, 'N' | Sends the 'Next' MIDlet to handset when developers want to specify multiple MIDlets being sent to a handset. For example:>MWay "path to first MIDlet Suite" "path to second MIDlet Suite"
|
| 'S' | Silent mode. This key disables the display of debug information to the console. It does not prevent the log file from capturing debug information if a /L option is specified by the developer. |
| 'F' | Enables and disables any debug filter option set by developer. This shortcut key can be used when the MIDlet is executing |
| 'L' | Enables and disables debug information being captured in developer specified log file. |
| 'C' | Displays the current MWay configuration. After the following MWay command, the 'C' shortcut outputs the following on the example PC.
|


