Java ME wireless on-device debugging
By Ondřej "Satai" Nekola on Jun 23, 2009
There is an other (a bit unusual and untested ;) ) way, that requires no cable, no Active Sync. You just needs a Windows Mobile device that supports Wi-Fi and that a Wi-Fi enabled computer or a wireless router. Here is a simple HOWTO.
- Install a Java(TM) ME runtime on your device. You can find it in the on-device/winmobile-arm subdirectory of your Java ME SDK 3.0 installation directory. More info about this in the previous blogpost.
- Make sure that your computer is running and somehow accessible via Wi-Fi. There is no difference between plugging it into Wi-Fi enabled router and starting an ad-hoc network on the computer.
- Turn the WiFi on your device on, write down it's IP address. (This can be different for different vendors and models a good point to start your search is START -> Settings -> Connections -> WLAN Settings -> Connection Status. Otherwise you should check documentation shipped with your device.)
- Check, that the phone is accessible from the computer. Run ping <IP_OF_THE_DEVICE> or tracert <IP_OF_THE_DEVICE>.
- Run the Sun Java CLDC Emulator runtime, that you have installed on device.
- Go to the bin subdirectory of SDK installation. Run device-address.exe add ip <IP_OF_THE_DEVICE> command here.
- Wait a few seconds, check that emulator.exe -Xquery output contains a newly connected device. (Or run the GUI shipped with the SDK and have a look at the Device Selector)
- Now you are done, the device should work as any other device or emulator. You can for example run emulator.exe -Xdescriptor:../apps/FPDemo/dist/FPDemo.jad -Xdevice:<NAME_OF_THE_DEVICE_FROM_XQUERY> that installs an example midlet on the device. For debbuging you can use NetBeans Mobility or run emulator.exe -Xjam:install=<YOUR_JAD> -Xdevice:<NAME_OF_THE_DEVICE_FROM_XQUERY> -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=12345,suspend=n and connect any debugger to the port 12345
And some smaller tips at the end:
- if you use a wireless router, you probably can configure it's DHCP server to provide all the time the same IP to your device. In such a situation, you don't need to run the device-address command every time. Your device is detected and connected every time, it appears in the wireless network.
- it is possible to connect multiple phones to the computer at the same time. It is great for debugging on several different devices.