ottaky@ottaky.com
 
HTML OK
CSS OK
 
 
ottaky.com supports..
ORG
no2id

MIDlet Development

Author: sjb (Steve Brown) - ottaky@ottaky.com
Date: 5th October 2008
See also: Sun JDK
Sony Ericsson SDK
NetBeans IDE
Some MIDlets

I was recently given a Sony Ericsson C902 by my mobile operator which got me thinking about developing some more applications for mobile phones running J2ME. The process of setting up a development environment has become slightly easier since the last time I was playing with such things, but I thought it might be useful to others if I described what I did to get a working setup.

The usual disclaimers apply..
.. whatever you do to your phone is your business and I won't be held responsible if you manage to screw something up.

Install the phone drivers

My phone came with a CD containing SE's software, but I didn't want to install it as Sony's supplied software invariably sucks. So, I popped the CD into the drive and exited the application setup. I then plugged in my phone using the supplied USB cable. As Windows discovered all the bits of new hardware, I instructed the driver installer to look in the drivers directory on the CD. When complete, I had all of the required drivers installed, but none of the rubbish SE software.

Enable developer mode

Unplug the phone. Then, press >*<<*<* to open the "Service" menu. Choose "Service settings" and set "Java developer mode" to "On". What this appears to do is provide a network interface to Windows when you plug the phone in.

Downloads part one

Download and install Sun's JDK and SE's SDK ..

Element URL Filename
JDK 6 Update 7 http://java.sun.com/javase/downloads/index.jsp jdk-6u7-windows-i586-p.exe
Sony Ericsson SDK 2.5.0.2 https://developer.sonyericsson.com/getDocument.do?docId=99962 semc_java_me_cldc_sdk.2-5-0-2.exe

.. accepting the default options for both.

Connect the phone

This next step tends to be somewhat flaky for me (on two different machines). Plug your phone into the PC using the USB cable, select "Phone mode" if prompted on the handset. You should see a network connection icon appear in the system tray. Start the SE connection proxy by clicking on Start, Sony Ericsson, Java ME SDK for CLDC, Connection Proxy. Once the proxy has started, click on Settings and select "Sony ericsson Device 3017 USB Ethernet Emulation (NDIS 5) - Packet Scheduler Miniport" for the Interface Name. Click Connect. You should, in theory, see something like this ..

Connection Proxy

.. which indicates that your phone is connected and ready to be used. If this part doesn't work for you, I can only suggest unplugging the phone, plugging it back in, repeatedly trying to connect with the Connection Proxy. Persevere and it will probably connect eventually - it can take up to a minute for the network interface to allocate itself an IP address. The whole process is not exactly user friendly.

I found this ..
.. description of how to fix persistent connection problems: https://developer.sonyericsson.com/message/121462#121462 which works for me.

Downloads part two

Download and install the NetBeans IDE ..

Element URL Filename
NetBeans IDE 6.1 Mobility Pack http://download.netbeans.org/netbeans/6.1/final/ netbeans-6.1-ml-mobility-windows.exe

.. and then click on Start, NetBeans, NetBeans IDE 6.1. When the IDE starts, click on the updates icon at the bottom right of the application and install all of the pending updates.

When NetBeans is up-to-date, click on Tools, Options, Miscellaneous, Profiler, Manage Platforms..., Add Platform..., and you should see something like this ..

Profiler

Select "Java ME MIDP Platform Emulator" and click Next. The wizard should find the SE SDK. Select the "Sony Ericsson SDK 2.5.0.2 for the Java(TM) ME Platform(Debug On-Device)" (for running / debugging on the phone) and "Sony Ericsson SDK 2.5.0.2 for the Java(TM) ME Platform(Emulator)" (for running / debugging in an emulator) items, then click through the rest of the options.

And finally ..

You should now be in a position to start writing MIDlets for your phone. To test your setup, in NetBeans, click File and New Project. Choose MIDP application, then click Next. For the emulator selection, Choose the "Debug On Device" option and set the Device option to SonyEricsson_JP-8 (or SonyEricsson_JP-7 if you want to ensure compatibility with older phones), then click through the rest of the wizard. This will create a new project with a "Hello, World" MIDlet already included.

Click the run button (or press F6) to compile the MIDlet and run it on your phone - all things being equal, you should see the "Hello, World" NIDlet running on your phone.

You can redefine the development target of a project using File, PROJECT_NAME Properies in NetBeans. I find this useful for developing the guts of the MIDlet using the emulator before starting to compile directly to the phone.

When you've created a MIDlet that you want to deploy, you'll find the JAD and JAR files in My Documents, NetBeansProjects, PROJECT_NAME, dist. If you place the files on a webserver, you'll probably want to use a .htaccess file like this ..

AddType text/vnd.sun.j2me.app-descriptor jad
AddType application/java-archive jar

.. and use the browser on the phone to download the JAD file.