当错误发生时,我的java代码中会抛出异常。然后,我使用jdb运行代码,这样当异常发生时,我可以看到代码所处的状态并进行调试。对于我抛出的所有异常,我放入了一个有用的字符串消息。但是,当jdb捕获到异常时,它不会同时打印该字符串。如何打印此字符串?
我在谷歌上搜索和阅读了文档,但我不知道怎么做。
如果我有测试类:
public class Test{
public static void main(String[] args){
throw new IllegalArgumentException("How do I view this string through jdb?");
}
}并通过jdb运行它:
$ jdb Test
Initializing jdb ...
> run
run Test
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
>
VM Started:
Exception occurred: java.lang.IllegalArgumentException (uncaught)"thread=main", Test.main(), line=3 bci=9
main[1] https://stackoverflow.com/questions/15579774
复制相似问题