Start Learning


Step 3: Run Your Application

Java Logo


Click the run button. If you have any build errors, correct them. Eventually, your application appears in the emulator.
HelloMIDlet incarnate

To change which emulator skin is used, Control-click on the project and choose Properties. Select Platform in the left pane. In the right pane, choose the emulator from the Device combo box.


You can run your application on a real phone by transmitting the application archive file to the phone. MIDP applications consist of two files. The first is the application descriptor, a text file that contains information like the application's name, API dependencies, archive size, and more. The second is a JAR file that contains the classes and resources of the application.

Devices typically examine the application's descriptor to help decide if they want to download the JAR file and install it.

Applications are deployed on devices using one of the following four techniques:

  • In a realistic deployment, the application and its descriptor file are placed on a web server. The phone obtains the files and installs the application in a process called Over the Air (OTA) deployment.
  • For testing, you can transmit the application JAR file to the device using Bluetooth.
  • For testing, you can transmit the application JAR file to the device over a USB cable.
  • For testing, you can transmit the application JAR file to the device by copying it to a memory card, then placing the card in the device.

The exact details of transferring files to a device vary widely, so you need to experiment a little to understand how it works for your device.

The application archive lives in a subdirectory of your project directory. By default, the Java ME SDK places your projects in <home>/JavaMESDKProjects, where <home> is your home directory. The application archive for this example is located here:


Assuming you are able to transfer this file to your device, the device should recognize it and allow you to run it.

Running the Application on a HTC Freestyle Using a Memory Card

This section describes transmitting the application to a HTC Freestyle from a Windows computer using a microSD memory card. This section describes the HTC Freestyle, but the actual UI or process is different from device to device.

Begin by inserting the card into your computer. It shows up as an additional drive. Locate AwesomeApplication.jar and copy it to the memory card.

Now eject the card from your computer. Insert the card in the HTC Freestyle and start it up. From the home screen, touch the Menu button. Scroll to the rightmost page of the menu by swiping your finger. Touch Tools. In the next menu, touch Java.

Touch the Menu button  Touch Tools  Touch Java

You will see a list of installed Java applications, which might be empty. Touch Menu, then Storage.

Touch Menu, then Storage

The screen shows a list of all Java applications found on the device or memory card. Choose AwesomeApplication.jar and touch Install. Touch OK to confirm your intent.

Choose AwesomeApplication.jar and touch Install  Touch OK

Finally, the HTC Freestyle gives you a chance to run the application.

AwesomeApplication on the HTC Freestyle

Adjusting the MIDP Version for Older Devices

For older devices, you might need to tell the Java ME SDK to use MIDP 2.0 instead of MIDP 2.1 when compiling the application. Control-click on the project and choose Properties. In the properties window, select Platform in the left pane, then click on MIDP 2.0.

AwesomeApplication properties

Click OK, then rebuild the project by choosing Run > Build Main Project from the menu.

Running the Application on a Nokia 6300 Using Bluetooth

This section describes transmitting the application to a Nokia 6300 from an OS X computer using Bluetooth. You should have previously paired the device with your computer.

To transfer the application JAR file, choose Send File... from the OS X Bluetooth menu, as shown here:

Choose Send File... from the Bluetooth menu

Navigate to AwesomeApplication.jar in the project directory.
Navigate to AwesomeApplication.jar

Now choose the destination device.
Choose the destination device

As the file transmits, you see its progress.
File progress

On the Nokia 6300, choose Menu > Apps. Navigate to AwesomeApplication and launch it:

SwooshMIDlet on the Nokia 6300

Some other deployment scenarios are described in the following documents.

In the video below, Jonathan Knudsen demonstrates how to install a MIDP application on an HTC mobile phone.

Next Tutorial: Learn More