Options for running MIDlets in the emulator are as follows:
Run in autotest mode. This option installs a MIDlet suite from a URL, runs it, removes it, and repeats the process. The purpose is to run test compatibility kits (TCKs) with the emulator, using a test harness such as JT Harness, JavaTest™ or Java Device Test Suite (JDTS). For example:
Given the above command, -Xautotest causes the emulator to repeatedly install, run, and remove the first MIDlet from the MIDlet suite provided through the HTTP URL. Once the emulator starts, it queries the test harness, which then downloads and installs the TCK MIDletAgent.
Run an application locally using the given JAD file.
Set the MIDlet suite’s security domain.
Run an application remotely using the Application Management Software (AMS) to run using OTA provisioning. If no application is specified with the argument, the graphical AMS is run. The commands are as follows:
install=jad-file-url | force | list | storageNames|
Install the application with the specified JAD file onto a device.
force. If an existing application has the same storage name as the application to be installed, force removes the existing application before installing the new application.
list. List all the applications installed on the device and exit. The list is written to standard output before the emulator exits.
storageNames. List all applications installed on the device. The list is written to standard output before the emulator exits. Each line contains one storage name in numerical order. The list contains only the name so the order is important. For example the first storage name must be storage number 1.
run=[storage-name | storage-number]
Run a previously installed application. The application is specified by its valid storage name or storage number.
remove=[storage-name | storage-number | all]
Remove a previously installed application. The application is identified by its valid storage name or storage number. If all is supplied, all previously installed applications are removed.
Install, run, and remove the application with the specified JAD file. Specifying transient causes the application to be installed and run and then removed three times.
This example includes OTA installation:emulator.exe -Xjam:install=http://www.myserver.com/apps/MyApp.jad -Xdevice:DefaultCldcMsaPhone2
The above command returns the ID of the installed application. Once you obtain the ID you can run it with: emulator.exe=Xjam:run=ID