0

Imagine you are handed a Java Eclipse Project. In this project there are a bunch of classes that call methods on each other, pass parameters and get things done, so the classes withing the project are quite interconnected.

Now then, there is one class in particular that you would like to figure out the workings of. Is there a way in Eclipse, through its tools, that would help me figure out the order in which each of the methods in that particular class are called?

I am aware that I can do System.out.println() inside each of the methods, and monitor the Console output to figure out the order that way, but that is too time consuming for really big classes.

Is there another way? Thanks

4

3 回答 3

2

试试apache 的Log4j API。会帮助你。

于 2013-05-01T17:16:50.707 回答
1

如果您使用默认快捷方式Ctrl Alt H,您将获得调用层次结构,它可以让您知道哪些方法调用了此方法以及您调用了哪些方法(并且您可以继续浏览这些方法)。

参考文献也可能非常有用(Ctrl Shift G)。

于 2013-05-01T17:33:56.657 回答
0

我不知道你想花多少时间在上面,但是 java 代理可以帮助你,因为你可以在运行时挂钩代码并编写一个监控工具。

另一种选择是在某个点设置断点,然后查看堆栈跟踪。

于 2013-05-01T17:29:04.460 回答