coollearner
coollearner

Reputation: 23

know the methods and classes running in a complicated java project

I am currently using a complicated open source java project with 10 packages and each packages having at least 7 classes each (eclipse is the IDE i'm using). It is a project with multiple usages/application. I'm only using 1 usage of the project so i dont need most of the other classes. I was able to run it and is giving me the output it says it would. I'm trying to edit the code or to insert a java computation so that i can have better output. But since the java project is too complicated for me, i don't know the specific classes/methods that are being used when the project is being ran for the usage that i want. When a project is running how do i know the flow of the classes/methods so that i will know the flow of the variables and so that i will know where to insert a different computation or algorithm. thanks

Upvotes: 0

Views: 111

Answers (2)

Marko Topolnik
Marko Topolnik

Reputation: 200168

Only 10 tiny packages? That's a VERY simple project you are working with. But anyway, try this: make your procedure (the code that calls the project's methods) repeat in an endless loop and have jvisualvm started and connected to your JVM. That's a Java profiler distributed with the JDK. It will give you the rundown on all code paths being taken. Only, it will expose you to the full complexities of a live JVM (many threads). You'll have to find yourself around.

Upvotes: 3

David
David

Reputation: 20063

Use a debugger and step through the code to watch changes in the variables.

You could also throw in a few System.out lines if you want a bit more of a dirty method.

Might be worth having a quick skim over

http://www.vogella.com/articles/EclipseDebugging/article.html

Upvotes: 2

Related Questions