How to get the text of an exception stack trace in Java ME?

前端 未结 5 1318
野的像风
野的像风 2021-02-15 13:20

In regular Java, you can get the text of a stack trace by passing a PrintWriter to printStackTrace. I have a feeling I know the answer to this (i.e. \"No\") but,

Is ther

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-15 14:09

    I don't thing there is a way to do that in CLDC 1.0. However, on some devices/OSes the underlying Exception class could be providing a way for accessing the stack trace (think newer CLDC versions). Just inspect the exception instance at runtime using reflection to see what members it exposes on your target platforms. You could then write some code that will be able to safely extract the stack trace on the platforms that offer such information.

提交回复
热议问题