Monday, December 1, 2008

Redirecting output on S60 devices

Sometimes you are so used to something that you don't remember to check for changes... This is what happened to me now with S60 debugging, I have some issues that only occur on my battered device and they are impossible to reproduce on an emulator.
Sure I can use the Log but what I get is an exception from an unclear source, I always invoke printStackTrace so I know the trace is there... With SE devices I would just plugin a cable and see the stack but with the Nokia I have been at this bug for days. In desperation I searched the internet for ways to get at the system output for S60 with no result... I found a tool from SE called Redirect.SYS but its only for their flavor of Symbian.
Then I ran into this which I immediately discarded since its a Java JAR so naturally it won't have access to the System output... Should have paid more attention! Turns out Nokia has an undocumented API (it is now documented obviously) to access the stream of the output/error stream from Java! It works on my E61 which is making my debugging experience that much better.

I'm blogging about this because if I didn't know about it, I bet most of you guys don't either and the results for System.out printStackTrace and S60 Symbian Nokia are somewhat problematic (hopefully this will help).

8 comments:

  1. Funny coincidence, I just ran that midlet a few days ago but didn't get any output. Thanks for rubbing it in, sounds like it is worth persisting and trying to get it working.
    (Has anyone played with AspectME or AspectJ to get some decent stack information on all platforms ?)

    ReplyDelete
  2. Nokia provide a tool to do on device debugging.

    http://www.paxmodept.com/telesto/blogitem.htm?id=355

    ReplyDelete
  3. I was never able to get the device debugging/log to work for me. I couldn't even get the S60 emulator running (the S40 one works just fine) maybe its my complex setup with dozens of VM's and simulators/emulators littered in my PC or the fact that my phone is just completely broken from abuse.

    Having said that this will probably work for other people and I think Nokia did a bad job getting the word out about these features... Which is a shame since most people would find this remarkably helpful (although S40 debugging is a bigger problem usually).

    ReplyDelete
  4. HI i'm a Chinese developer .I try to use lwuit to devloping Chinese Support Applications .but I couldn't find the way to solve the charset Problem .Could you give me some advices on how to get lwuit SUpport gb2312 charset !

    Thank u qintao1987@126.com

    ReplyDelete
  5. Use system fonts as explained in the forum: http://forums.java.net/jive/forum.jspa?forumID=139&start=0

    ReplyDelete
  6. Hi
    nokia always had good debugging tools (for s60 u could use carbide j along with nokia debug program via bluetooth) it not only let u system out logs but also let u to use break points and step by step run. i dont think it is supported any more though ... sad.
    even their series 40 ( on some particuler devices) u could connect to it via terminal and get the redirected logs.

    motorola also u could use the midway program for logs (depand on operator and network usage)

    SE also always had with their device explorer the sys out logs

    i've been developing on handset for soooo long i know all the tricks in the book...

    BR
    shai (yes im also named shai)

    ReplyDelete
  7. thank u i got it through the l10n,

    ReplyDelete
  8. Hello Every one , I am try run j2me application on 9300i device developed it by LWUIT package but the application can not be working on that device.

    ReplyDelete