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.
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.
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??