Home » Android » java – Infinite loop, how to know in Eclipse what code is running now?

java – Infinite loop, how to know in Eclipse what code is running now?

Posted by: admin June 15, 2020 Leave a comment


I am using eclipse to run some android/java code in my device. Sometimes the code seems to be stuck in a loop. And sometimes it works. I was wondering, is there a way in eclipse where I can tell it to show my what is the current running? Or even last method called? I want to know where this “code stuck” is so I can fix it. Stepping in won’t help as I need the code to run without stoppage for this to reproduce

Please help

How to&Answers:

Run the app with eclipse debugger connected. When it got stuck click the suspend (“pause”) button. Maybe you have to do some single-steps to jump out of some lib call and get to your code. In debug perspective you can see the call trace which tells you the function you’re in.


If you don’t want or can’t run the application in debug mode, you can use Java VisualVM, a tool that can be found at the bin folder of your installed JDK under the name jvisualvm.exe.

It provides you a way to see all the running threads, the methods that were called, and, on a case of a deadlock, it can help you to find out where it happens.

I never used this tool to monitor an application on other machine or even other device, but, I know that under “File” menu there is an option called “Add Remote Host…”. Maybe, you can monitor you application from there.