views:

1936

answers:

10

Has anybody had any success ever attaching a debugger to a tethered device? I am able to debug my j2me application in the emulator, but have a lot of trouble sorting out phone-specific problems when they come up. The phone I'm using is a Nokia N95, but ideally the debug process would work on any phone.

Is this possible? If so does anyone have steps they've used to set it up?

A: 

Unfortunately this is not generally possible. Some makers (like Sony-Erricson) support this on some of their phones but not all. I am not sure if there is on-device-debugging tool for N95 but you can use Nokia's emulator which should be pretty close to the device. The new Java ME SDK comes with promise of real ODD in near future. But it still very much depends on OEM cooperation.

Honza
+1  A: 

Motorola phones support a debugging interface called KDWP(Motodev registration required).Their MIDway tool can also be useful for getting debug trace information from a midlet running on a device.

rupello
A: 

Sony Ericsson supports debugging on ebery phone at least since K700, this is done by using KDWP. UIQ 3 communicators also can be debugged the same way.

By the way, it the latest phones by SE it is even possible to monitor memory consumption and CPU profiling. So if you wanna debug your apps on real phones, I would suggest also using SE phones, they are really good at it. I use Netbeans, and it works without any problems with any SE phone.

Malcolm
+2  A: 

As other stated, on device debug is something that strictly depends on manufacturer's will and often it's nearly impossible. However, i can address you to Gear Java Mobile Framework that gives you the opportunity to use an on-device debug console to print your messages and thus read phone specific issues. If you need some explanation on how to use it, take a look to this tutorial

Stefano Driussi
A: 

Find device specific emulators

http://j2meemulators.blogspot.com/2009/02/j2me-device-emulators.html

A: 

Others are correct here in that on-device debugging is very much device specific. I haven't done anything with Series 60, but at least on Series 40 phones, I had to open up a CommConnection and write out to it in order to see much of anything going on. The device emulators are again a mixed bag, but you usually can get 90% of the way to your application working on them and can usually get your debugger connected to them. If you aren't making use of any of the hardware on the phone, that should get you most of the way there.

jjb
A: 

I've used the Blackberry tools on occasion to debug J2ME applications (without using RIM APIs) but it is very slow and still is only emulation, not the actual device (but it sometimes does help to shake the odd thing out). I agree it is frustrating when you have something running on an emulator only to find that it doesn't run on the hardware.

Michael Tiller
A: 

I think it is possible to add additional debugging information on preprocess step. Like this:

public void myMethod() {
    Debug.traceMethod("myMethod");
    int var = 1;
    Debug.newLine();
    var++;
    Debug.newLine();
    ...
}
Pavel Alexeev
A: 

I find a good debugging method is to control a string value which gets painted on top of everything else when it is not null. This will work anywhere, though obviously isn't ideal, but can be used to catch Exceptions, print values etc. Of course you're limited to the small screen, but in theory you could even code some scrolling functionality.

Some people use RMS logging but personally I could never be bothered.

As others have said here, Motorola have Midway which I think is great.

Sam
A: 

Yes, I've done it! I've made a tool on C#, which adds some code, which is then used display last successful method name and line number when some error occurs. It, of course, decrease performance. But it is not such important when you're debugging.

Pavel Alexeev