在Java中获取呼叫层次结构 [英] Getting a call hierarchy in java
本文介绍了在Java中获取呼叫层次结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在查找错误时遇到了很大的麻烦,知道哪种方法称为某个方法将大有帮助。有没有一种简单的方法可以从Java获取调用层次结构? Java仅是应用程序的一小部分,因此我无法在eclipse / net Bean中编译和运行整个应用程序,因此无法访问IDE调试器的调用层次结构。
I am having real trouble tracking down a bug and it would help be a lot to know which method called a certain method. Is there an easy way to get a call hierarchy from java? Java is a small part of the app so I cannot compile and run the whole app in eclipse/net beans so I don't have access to an IDE debugger's call hierarchy.
推荐答案
Thread.currentThread().getStackTrace();
或
Exception ex = new Exception();
ex.printStackTrace();
虽然速度很慢,但是可以用于调试。 此处的API文档
It's fairly slow, but fine for debugging purposes. API docs here.
这篇关于在Java中获取呼叫层次结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文