Debugging j2me on a Device
Asked Answered
C

9

7

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?

Chalybite answered 1/12, 2008 at 17:37 Comment(0)
G
3

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.

Geese answered 13/12, 2008 at 11:32 Comment(0)
A
2

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.

Audrey answered 2/12, 2008 at 2:21 Comment(0)
G
2

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

Gorged answered 3/2, 2009 at 10:4 Comment(0)
R
1

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.

Right answered 1/12, 2008 at 18:47 Comment(0)
F
1

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.

Fugate answered 31/7, 2009 at 20:41 Comment(0)
B
0

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.

Bidding answered 15/5, 2009 at 16:17 Comment(0)
P
0

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.

Projector answered 18/5, 2009 at 15:39 Comment(0)
D
0

You can not debug step by step like android or other SDK.

In J2ME you can trace the error by adding the log statement in the code and add another midlet and display that log screen in that midlet.

Example: add Log.p("Log statement.....");

LogMidlet.java 
// Add the following line in the startup method of this midlet.
    Log.getInstance().showLog();

This way you can somehow track the error in j2me.

Darleen answered 7/11, 2011 at 4:42 Comment(0)
P
-2

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();
    ...
}
Paganism answered 21/7, 2009 at 9:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.