By Tomas Brandalik on Dec 26, 2009
As you probably know we ship Java ME SDK with cldc java runtime for Windows Mobile. You can deploy MIDlets onto Windows Mobile handset as easy as it was an emulator. Connecting a WinMobile handset from Java ME SDK is very straightforward using activesync on windows. It's really just a matter of plugging device and runing jvm on it.
Situation is different on Mac since there's no free activesync support. Fortunately most of WinMobile handsets come equipped with Wi-Fi and we can take advantage of Mac's AirPort networking. What we need is to create computer-to-computer network and let WinMobile handsets connect to the network. Only trick is to find out IP address of the handset. When you have the IP and you have started jvm let Java ME SDK look up the handset. Since it's recognized you can deploy MIDlet on it an also debug your applications right on the handset using Netbeans Mobility Pack.
Before you start with this tutorial copy .cab file from Java ME SDK installation folder named "on-device" to your WinMobile handset and install it.
Create computer-to-computer network and give a name to it (in our example "MyNetwork").
On handset look into Settings->Conections->Wi-Fi and search for computer-to-computer networks and connect to network. After your handset is successfully connected to "MyNetwork" look at details of Wi-Fi adapter where you find assigned IP address. Just to be sure open terminal and try to ping the handset
if your handset is reachable you can continue in Java ME SDK. Launch JMESDK and look at Device Selector window where 2 new buttons have been added in version 3.0 for Mac. Look at the image below where the buttons are highlighted
The first one opens a wizard which helps you to connect to handset. All you need is to specify IP address. When the jvm on handset responds to look up from JMESDK it is added under the device node "Other" as you can see on the image above. Second button refreshes connection to handset. My htc diamond falls asleep after some time and when it is awake I need to refresh connection. Device registration can be made also from command line
device-address add ip 169.254.205.222
or on device-manager. Click on device manager icon in status bar and choose manage device addresses.
Now with the handset connected you can deploy MIDlet on it. Just open one of the sample projects right click on CldcWinceEmu1 node and choose "Run Project".
Of course all of this you can do also without Mac AirPort simply over the Wi-Fi router if you have one available. About debugging on-device using Netbeans Mobility Pack I will write soon. I suppose after you're successfull with this setup you will figure out how to make it work for Netbeans MP as well.