Reputation: 23
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
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
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