aspose file tools*
The moose likes Java Micro Edition and the fly likes J2ME printStatckTrace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Mobile » Java Micro Edition
Bookmark "J2ME printStatckTrace " Watch "J2ME printStatckTrace " New topic
Author

J2ME printStatckTrace

prabagar gp
Greenhorn

Joined: Feb 22, 2006
Posts: 2
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

Joined: Feb 19, 2005
Posts: 231
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.


Eduardo Marques
Get ready for your SCMAD certification at J2MECertificate.com - See what all the buzz is about ...
Anton Lunev
Greenhorn

Joined: Jan 15, 2006
Posts: 4
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

Joined: Sep 08, 2005
Posts: 311
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

Joined: Dec 08, 2004
Posts: 102
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

Joined: Sep 08, 2005
Posts: 311
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
 
subject: J2ME printStatckTrace
 
Similar Threads
Program just shuts down. No error, nothing!
voice capturing
Problem: Capturing Real Time media using Midlets
Capturing printStackTrace()
Connecting a mobile phone to PC via USB