I want to control execution of java program without debugger, for example there is a class like below
1. class Foo {
2. void bar() {
3. print("i am 3rd line of class Foo");
4. print("i am 4th...");
5. if(true)
6. print("i am 6th");
7. }
8. }
I want to know when java is going to execute any of the above lines and until i don't tell it to continue execution it should wait for me!
If you are familer with debugger in eclipse IDE you would definately know that if we place breakpoint somewhere in java source code the debugger pauses the execution at that line and waits until we hit step in or next button in order to execute next line or statement of program. Basically it is controlling the execution of program plus it is getting every bit of information like declared variables, current running function, current executing line, etc. I also want the same functionality but instead of debugger i would like to use my own java code. You can say that i want to debug java code with in the code.
For example: If java is executing line number 3, it should inform me that i am (java) going to execute line number 3 and until i don't tell it to continue it should wait.
Another example:
5. void bar() {
6. // Inform me that java is going to execute line no. 7
7. print("Printing something...");
8. // Again inform me that java is executing line no. 9
9. print("bar");
10.}
In nutshell i want to controll execution of my program line by line, i don't care about performence just want to achieve my goal!
I tried to make this question as simple as possible but if you have still problem in understanding (as it is a little tricky), let me know in the comment box below!
Thank you in advance ;)