File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

J2ME printStatckTrace

 
prabagar gp
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Need any suggestion to capture printStackTrace() output while running the application in a J2ME device.
Since printStackTrace() retruns void ,we cannot capture it into a form.
Any help in this reagrd.

Thanks
-Prabagar
 
Eduardo Marques
Ranch Hand
Posts: 231
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
During development you can see the ouput of printStackTrace() in WTK's console.

At runtime, I think the most you can do is call the getMessage() instance method on the Exception object and display the exception message on whatever you find suitable.

There is no way for retrieving an exception's stack trace in J2ME (CLDC / MIDP configuration at least, not sure about a CDC based configuration).
In J2SE it's easy, you only need to use the getStackTrace() method.
 
Anton Lunev
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
afaik, you may use some kind of logging on a device (e.g. write exeption to storage or file if your device supports it)
 
Ramender Mall
Ranch Hand
Posts: 311
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Redrick Shuhart:
afaik, you may use some kind of logging on a device (e.g. write exeption to storage or file if your device supports it)


well,
that seems like what I was thinking abt this problem.
I dont know how to create, a file by J2ME application on a handset, except RMS of course. Can we do that???
IF WE CAN, then we may change System.err's (where, printStackTrace() writes the output) value to this outputStream of our file....and later read that file to get the value.

Too far-fetched??? :roll:

- Ramy..
 
William Frantz
Ranch Hand
Posts: 102
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah, it's too far fetched.

Some devices do have APIs that allow you to read/write to the file system. The vast majority of devices only allow access to RMS.

You can't 'redirect output' to RMS.

William Frantz
http://sprintdevelopers.com
 
Ramender Mall
Ranch Hand
Posts: 311
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by William Frantz:
Yeah, it's too far fetched.

Some devices do have APIs that allow you to read/write to the file system. The vast majority of devices only allow access to RMS.

You can't 'redirect output' to RMS.



hummm,
I wasnt talking about 'redirecting output to RMS', because as far as I know, we cant use RMS as an OutputStream.
What I was trying to ask was(or thinking aloud was ) - Can we 'create' a file on the device, other then RMS, say any txt or watever file?? , and then use it as an outputStream??

- Ramy..
[ February 22, 2006: Message edited by: Ramender Mall ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic