Reputation: 41
H All, I want to trace which lines are executed in my code so that I can highlight those lines. Due to this i am able to trace the code which is not tested.
i found out that JDB is way through which I can actually debug my application but I am not able to connect JDB with my eclipse code which is running. So in good scenario what I want is my code is running on eclipse and I am connected to that code via JDB and able to get all the line numbers which are executred
Upvotes: 3
Views: 1353
Reputation: 586
This will get you the line number in the file that the stack trace code is called in:
Thread.currentThread().getStackTrace()[1].getLineNumber();
This will get you the line number in the file where the method that contains the stack trace code is called:
Thread.currentThread().getStackTrace()[2].getLineNumber();
Upvotes: 2
Reputation: 736
I think Eclipse Debugger would do the job, so you can go trough you code line by line
http://www.eclipse.org/downloads/packages/eclipse-ide-java-developers/junor
but this is included in nearly any ide
Upvotes: 1