• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Hunting down an exception

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
The lastest program I've been working on builds just fine, but outputs a nullpointer exception when run.
I've been having some difficulty tracking this null pointer down. What I'd like to konw if theres a way to run your program step by step, which would be a big help in finding it.
I'm just using the KToolbar at the moment. Would it help for me to download another development enviroment like JBuilder or something ?
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not familiar with KToolbar. Does it give you a stack trace when the exception is thrown? It will give you a good place to start at least.

Unfortunately, I can't offer much more advice than that as I am a relative newbie to J2ME myself.

Good luck,

Layne
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well the stack trace should give you a clue to the exact line of code that is causing the problem.

Yes another IDE would help step through the code.

Good Luck

Mark
 
Andy Robinson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's not giving me a stack trace, thats a big part of the problem, the exception could be anywhere
Just out of curiosity what IDE do you guys use ? How helpful are they ?
 
Mark Spritzler
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually for J2ME I only use TextPad and compile in the Toolkit. I have used IntelliJ Idea, but I haven't tried remote debugging. Wait I take that back, for some reason I think I might have.

But in almost all cases I just read the stack trace.

Mark
 
author
Posts: 1436
6
Python TypeScript Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try to catch the exception and use exception.printStackTrace() to print the stack trace to the console. Of course, this only works in the emulator. On the real device, your need a logging tool to log the stack trace to RMS or send it to a network server or display it on top of your app screen.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you run the emulator from the command-line, it should print the stack trace directly to the console, IIRC. If not, Michael's suggestion should do the trick.

Layne
 
Andy Robinson
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Cheers everyone, the error has now been hunted down and exterminated
 
reply
    Bookmark Topic Watch Topic
  • New Topic